M
Mr. B
GRRRR... I've run across a situation in which I have NO solution. Hopefully
there is one. VB.net.
It's rather simple.
I've a ComboBox that get's populated via a Database. And I pre-select (during
Formload) the Index using SelectedIndex:
' Get User info from Data Base fill
daPickUser.Fill(dsPickUser.MASTER_PRM_EMPLOYEE)
cmbUserName.SelectedIndex = cmbUserName.FindStringExact(strUserID)
Now the above works just fine. It finds my strUserID (ie: FEU001 which is
Index #28) and that is what is listed in the ComboBox on startup. Great!
However, I want to use the Combobox to select another User at some time. When
I ENABLE the following Private Sub for the Combobox, I get my troubles...
My Combobox even is thus...
Private Sub cmbUserName_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles cmbUserName.SelectedIndexChanged
dsTimberline.tblTimeEntry.Clear()
' Refresh the Data Grid with New User Selected
strUserID = cmbUserName.Text
daTimberline.SelectCommand.Parameters(0).Value = strUserID
daTimberline.Fill(dsTimberline.tblTimeEntry)
End Sub
What happens is that on startup, somehow the Combobox SelectedIndexChanged
sets my Combobox Index to Zero (0)... every time. I don't want Index of 0.
But the listing of what is the Index number of my strUserID.
How can I prevent the cmbUserName_SelectedIndexChanged from being triggered
during startup???
Regards,
Bruce
there is one. VB.net.
It's rather simple.
I've a ComboBox that get's populated via a Database. And I pre-select (during
Formload) the Index using SelectedIndex:
' Get User info from Data Base fill
daPickUser.Fill(dsPickUser.MASTER_PRM_EMPLOYEE)
cmbUserName.SelectedIndex = cmbUserName.FindStringExact(strUserID)
Now the above works just fine. It finds my strUserID (ie: FEU001 which is
Index #28) and that is what is listed in the ComboBox on startup. Great!
However, I want to use the Combobox to select another User at some time. When
I ENABLE the following Private Sub for the Combobox, I get my troubles...
My Combobox even is thus...
Private Sub cmbUserName_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles cmbUserName.SelectedIndexChanged
dsTimberline.tblTimeEntry.Clear()
' Refresh the Data Grid with New User Selected
strUserID = cmbUserName.Text
daTimberline.SelectCommand.Parameters(0).Value = strUserID
daTimberline.Fill(dsTimberline.tblTimeEntry)
End Sub
What happens is that on startup, somehow the Combobox SelectedIndexChanged
sets my Combobox Index to Zero (0)... every time. I don't want Index of 0.
But the listing of what is the Index number of my strUserID.
How can I prevent the cmbUserName_SelectedIndexChanged from being triggered
during startup???
Regards,
Bruce