Results 1 to 11 of 11

Thread: ComboBox and updating data

  1. #1

    Thread Starter
    Frenzied Member Mike Hildner's Avatar
    Join Date
    Jul 2002
    Location
    Des Moines, NM
    Posts
    1,690

    ComboBox and updating data

    I have a ComboBox that is data bound to a particular Dataset's table and column. When the DropDownStyle is DropDownList, a user's changes to the field are not recognized.

    Changing the DropDownStyle to DropDown - things work just fine - either by selecting from the list or manually typing.

    The latter is not an option, as I need to restrict the possible values. What am I missing here? Any ideas are appreciated.

    Mike

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083

    Re: ComboBox and updating data

    I had quite similar problem with DropDownList . I was trying to get the selected item by the user like this :
    MsgBox(ComboBox4.SelectedItem()) and always throw an exception but when I changed the dropping style to ropDown it works . at the end I used this :
    MsgBox(ComboBox4.Text) along with DropDownList property and worked fine . I dunno if this would give you any clue or not !

  3. #3

    Thread Starter
    Frenzied Member Mike Hildner's Avatar
    Join Date
    Jul 2002
    Location
    Des Moines, NM
    Posts
    1,690
    Well, it helped in that I know I'm not doing something really stupid, seems like there's a problem when setting the DropDownStyle to DropDownList.

    Got around the problem by manually (through code, that is) updating the dataset's table/row/column with the Text property of the ComboBox.

    Seems to me this is not intended behavior, which leads me to a (newbie) question: Is there an official bug list I can search/report a bug? Searched msdn but could not find.

    TIA,
    Mike

  4. #4
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    It is probably a bug . that's what I though then . There are a lot of bugs in this version and in the promising version as well that called VS.NET2003 . Let me see if I can find some of them.

  5. #5
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083


    They are increasing day by day , week by week , product by product .

  6. #6

    Thread Starter
    Frenzied Member Mike Hildner's Avatar
    Join Date
    Jul 2002
    Location
    Des Moines, NM
    Posts
    1,690
    Thanks, Pirate, appreciate your help. Always fun to learn something new and never know if it's my code or not. Keeps me busy anyway........

  7. #7
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    No problem dude ! Did you find similar problem on the list ?

  8. #8

    Thread Starter
    Frenzied Member Mike Hildner's Avatar
    Join Date
    Jul 2002
    Location
    Des Moines, NM
    Posts
    1,690
    No, could not find on either list. The jelovic site has an email link to report a bug, which I'm writing up now.

    One might think that Microsoft has an official site for these kind of things, but then again, thinking usually gets me in trouble.

  9. #9
    Fanatic Member rudvs2's Avatar
    Join Date
    Mar 2001
    Location
    NZ
    Posts
    935
    okay use the dropdown style

    but to ensure only entrys on the list get used place in some auto search code ps maybe also a lil bit of validation

    the code i use for the purpose is as follows

    VB Code:
    1. Private Sub comboBox1_KeyUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles cmbProdCat.KeyUp
    2.         AutoComplete_KeyUp(comboBox1, e)
    3. End Sub
    4.  
    5. Public Sub AutoComplete_KeyUp(ByVal cbo As ComboBox, ByVal e As KeyEventArgs)
    6.         Dim sTypedText As String
    7.         Dim iFoundIndex As Integer
    8.         Dim sFoundText As String
    9.         Dim sAppendText As String
    10.         Select Case e.KeyCode 'allow select keys without auto completing
    11.             Case Keys.Back, Keys.Left, Keys.Right, Keys.Up, Keys.Delete, Keys.Down
    12.                 Return
    13.         End Select
    14.         'get the typed text and find it in the list
    15.         sTypedText = cbo.Text
    16.         iFoundIndex = cbo.FindString(sTypedText)
    17.         'if the typed text is found then auto complete
    18.         If iFoundIndex >= 0 Then
    19.             sFoundText = cbo.Items(iFoundIndex)
    20.             sAppendText = sFoundText.Substring(sTypedText.Length)
    21.             cbo.Text = sTypedText & sAppendText
    22.             cbo.SelectionStart = sTypedText.Length
    23.             cbo.SelectionLength = sAppendText.Length
    24.         Else
    25.             cbo.SelectedIndex = 0
    26.         End If
    27. End Sub

  10. #10
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    hmm , Is this going to solve dropdown list problem , coz I had similar to that problem too !

  11. #11
    New Member
    Join Date
    Jun 2006
    Posts
    1

    Re: ComboBox and updating data

    I experienced a similar error - when I add an item to the combobox's datasource, the display in the collection turns to "AssemblyName.ClassName". Here's how I overcame the bug:

    cmbStudyTracks.DataSource = Nothing
    cmbStudyTracks.DataSource = _studyTracks
    cmbStudyTracks.DisplayMember = "Name"
    cmbStudyTracks.ValueMember = "ID"

    Works fine now.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width