G
Guest
Hello
I'm not sure if I should give up trying to find an answer here...or just keep posting my problem..
I'm having problems with a listbox..
I have a listbox that is populated when a user presses a button (retrieve). There is a textbox on the form, and if the textbox is left blank, and the user presses the button, all records show in the listbox. If the user enters a specific item into the textbox, then presses the button, only that record shows in the listbox. There are fields on the form which are populated by data associated with what is selected in the listbox
All this works great...my problem is this
The first time 'retrieve' is clicked, it works great, but then, if something else is entered into the textbox, or it is cleared to retrieve all records, when the button is clicked, the listbox doesn't display it's contents
The data is there...all fields on the form are filled in correctly, and you can even click on the list box to change what is selected, you just can't see anything in the list box...
I'm baffled
I'm pasting my code below
Sorry this is so lengthy! Thanks in advance!
Ambe
Private Sub butRetrieve_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butRetrieve.Clic
If txtCPMain.Text <> "" The
get_specific_CP(
Els
get_all_CPs(
End I
End Su
*
Sub get_specific_CP(
lBoxCP.DataSource = Nothin
lBoxCP.Items.Clear(
lBoxCP.Refresh(
DsCP1.Clear(
SqlDA_CP.Fill(DsCP1
Dim dtbCP As DataTabl
dtbCP = DsCP1.Tables(0
Dim dtvCP As New DataView(dtbCP
dtvCP.RowFilter = "STR_CUTTING_PERMIT = '" & txtCPMain.Text & "'
lBoxCP.DataSource = dtvC
lBoxCP.DisplayMember = "STR_CUTTING_PERMIT
fill_all_textfields(
End Su
*
Private Sub get_all_CPs(
lBoxCP.DataSource = Nothin
lBoxCP.Items.Clear(
lBoxCP.Refresh(
DsCP1.Clear(
SqlDA_CP.Fill(DsCP1
lBoxCP.DataSource = DsCP1.Tables(0
lBoxCP.DisplayMember = "STR_CUTTING_PERMIT
End Su
I'm not sure if I should give up trying to find an answer here...or just keep posting my problem..
I'm having problems with a listbox..
I have a listbox that is populated when a user presses a button (retrieve). There is a textbox on the form, and if the textbox is left blank, and the user presses the button, all records show in the listbox. If the user enters a specific item into the textbox, then presses the button, only that record shows in the listbox. There are fields on the form which are populated by data associated with what is selected in the listbox
All this works great...my problem is this
The first time 'retrieve' is clicked, it works great, but then, if something else is entered into the textbox, or it is cleared to retrieve all records, when the button is clicked, the listbox doesn't display it's contents
The data is there...all fields on the form are filled in correctly, and you can even click on the list box to change what is selected, you just can't see anything in the list box...
I'm baffled
I'm pasting my code below
Sorry this is so lengthy! Thanks in advance!
Ambe
Private Sub butRetrieve_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butRetrieve.Clic
If txtCPMain.Text <> "" The
get_specific_CP(
Els
get_all_CPs(
End I
End Su
*
Sub get_specific_CP(
lBoxCP.DataSource = Nothin
lBoxCP.Items.Clear(
lBoxCP.Refresh(
DsCP1.Clear(
SqlDA_CP.Fill(DsCP1
Dim dtbCP As DataTabl
dtbCP = DsCP1.Tables(0
Dim dtvCP As New DataView(dtbCP
dtvCP.RowFilter = "STR_CUTTING_PERMIT = '" & txtCPMain.Text & "'
lBoxCP.DataSource = dtvC
lBoxCP.DisplayMember = "STR_CUTTING_PERMIT
fill_all_textfields(
End Su
*
Private Sub get_all_CPs(
lBoxCP.DataSource = Nothin
lBoxCP.Items.Clear(
lBoxCP.Refresh(
DsCP1.Clear(
SqlDA_CP.Fill(DsCP1
lBoxCP.DataSource = DsCP1.Tables(0
lBoxCP.DisplayMember = "STR_CUTTING_PERMIT
End Su