Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
vk18
Posting Yak Master
146 Posts |
Posted - 2006-11-28 : 18:47:13
|
Hello FriendsI have a List Box and a Text Box on a form. I have 10 Items in the list box. 1 2 3 ...10. When i select the 10th itemin the List Box it is still displaying 1st item in the Text Box. Here is my code. can you guys tell me what i am doing wrongThxThis is the code for populating the selected item in the text box Private Sub populatesubgrouptext(ByVal subgrouptext As String) Dim sql As String Dim dbfunctions As New DatabaseUtilities Dim objdatarow As DataRow Try sql = "select description from tblsubgroups where ckid = '" & subgrouptext & "'" objdatarow = dbfunctions.GetSQLDataRow(CONNECTIONSTRING, sql) If objdatarow("description") Is DBNull.Value Then Me.txtsubgroupdesc.Text = "" Else Me.txtsubgroupdesc.Text = objdatarow("description") End If Catch ex As Exception End Try End SubOn Select Index changed i have this codepopulatesubgrouptext(Me.lstsubgroup.SelectedValue)Or is there any other way to display this data in the text box |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-11-29 : 01:49:00
|
Select Index Changed?What happened to old fshioned Click event?Peter LarssonHelsingborg, Sweden |
 |
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2006-11-29 : 09:04:58
|
You definitely want to use Index Changed, since not everyone is clicking the mouse.Anyway, I'd set some break points and step through your code to ensure that things are executing properly, that's usually the best way to troubleshoot. It is hard to tell what is going on with just those small snippets of code.Also, do not concatenate together SQL strings with input like that -- always use parameters!see: http://weblogs.sqlteam.com/jeffs/archive/2006/07/21/10728.aspx- Jeff |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-11-29 : 09:08:17
|
Click is fired even when changing rows with keyboard.Peter LarssonHelsingborg, Sweden |
 |
|
|
|
|