Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. About the combobox textchange event

About the combobox textchange event

Scheduled Pinned Locked Moved Visual Basic
csharpdatabasehelpmysql
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    drexler_kk
    wrote on last edited by
    #1

    Dear all, I'm new to this VB.NET,my platform using now to do the development is Visual Studio 2008 using the VB.NET 2008 Window Form to create a lorry transportation management system. I'm facing problem with the combobox textchange event now. I'm using MySQL 5.0 with SQLYog v5.29 to develop this system. The following is a form code for the user to insert the Delivery Order document:

    Imports MySql.Data.MySqlClient

    Public Class InputDO
    Public Shared MyConnString As String = "Server=;Database=logistic_sysdb;Uid=root;Pwd=;"
    Public Shared ObjMyConn As New MySqlConnection
    Public Shared ObjComm As New MySqlCommand
    Public Shared ObjRead As MySqlDataReader
    Public Shared SQL As String

    Dim ObjAdapter As MySqlDataAdapter
    Dim ds As DataSet
    Dim dt As DataTable
    Dim dt1 As DataTable
    
    Private Sub InputDO\_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim i As Integer
    
        ObjMyConn = New MySqlConnection(MyConnString)
    
        'Load the information into Lorry Number Combobox
        Try
            SQL = "SELECT \* FROM lorry\_detail"
            ds = New DataSet
            ObjAdapter = New MySqlDataAdapter(SQL, ObjMyConn)
            ObjAdapter.Fill(ds, "Lorry\_Number")
            dt = ds.Tables("Lorry\_Number")
    
            For i = 0 To dt.Rows.Count - 1
                ComboBox1.Items.Add(dt.Rows(i).Item(0))
            Next
    
        Catch ex As Exception
            MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly, "Connection Error !!")
        End Try
    
        Try
            SQL = "SELECT \* FROM company\_detail"
    
            ds = New DataSet
            ObjAdapter = New MySqlDataAdapter(SQL, ObjMyConn)
            ObjAdapter.Fill(ds, "Client\_Company")
            dt1 = ds.Tables("Client\_Company")
    
        Catch ex As Exception
            MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly, "Connection Error !!")
    
        End Try
    
    End Sub
    
    Private Sub ComboBox2\_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox2.TextChanged
        Dim x As String ' x = The Client Company name that stored at dt1
        Dim i As Integer
    
        x = ComboBox2.Text
    
        For i = 0 To dt1.Rows.Count - 1
            If x = dt1.Rows(i).Item(1) Then
                ComboBox2.Items.Add(dt1.Rows(i).Item(1))
            End If
    
        Next
    
    End Sub
    

    End Class

    I would like to show the similar

    _ 1 Reply Last reply
    0
    • D drexler_kk

      Dear all, I'm new to this VB.NET,my platform using now to do the development is Visual Studio 2008 using the VB.NET 2008 Window Form to create a lorry transportation management system. I'm facing problem with the combobox textchange event now. I'm using MySQL 5.0 with SQLYog v5.29 to develop this system. The following is a form code for the user to insert the Delivery Order document:

      Imports MySql.Data.MySqlClient

      Public Class InputDO
      Public Shared MyConnString As String = "Server=;Database=logistic_sysdb;Uid=root;Pwd=;"
      Public Shared ObjMyConn As New MySqlConnection
      Public Shared ObjComm As New MySqlCommand
      Public Shared ObjRead As MySqlDataReader
      Public Shared SQL As String

      Dim ObjAdapter As MySqlDataAdapter
      Dim ds As DataSet
      Dim dt As DataTable
      Dim dt1 As DataTable
      
      Private Sub InputDO\_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
          Dim i As Integer
      
          ObjMyConn = New MySqlConnection(MyConnString)
      
          'Load the information into Lorry Number Combobox
          Try
              SQL = "SELECT \* FROM lorry\_detail"
              ds = New DataSet
              ObjAdapter = New MySqlDataAdapter(SQL, ObjMyConn)
              ObjAdapter.Fill(ds, "Lorry\_Number")
              dt = ds.Tables("Lorry\_Number")
      
              For i = 0 To dt.Rows.Count - 1
                  ComboBox1.Items.Add(dt.Rows(i).Item(0))
              Next
      
          Catch ex As Exception
              MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly, "Connection Error !!")
          End Try
      
          Try
              SQL = "SELECT \* FROM company\_detail"
      
              ds = New DataSet
              ObjAdapter = New MySqlDataAdapter(SQL, ObjMyConn)
              ObjAdapter.Fill(ds, "Client\_Company")
              dt1 = ds.Tables("Client\_Company")
      
          Catch ex As Exception
              MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly, "Connection Error !!")
      
          End Try
      
      End Sub
      
      Private Sub ComboBox2\_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox2.TextChanged
          Dim x As String ' x = The Client Company name that stored at dt1
          Dim i As Integer
      
          x = ComboBox2.Text
      
          For i = 0 To dt1.Rows.Count - 1
              If x = dt1.Rows(i).Item(1) Then
                  ComboBox2.Items.Add(dt1.Rows(i).Item(1))
              End If
      
          Next
      
      End Sub
      

      End Class

      I would like to show the similar

      _ Offline
      _ Offline
      _mubashir
      wrote on last edited by
      #2

      drexler_kk wrote:

      I have select all the client company into dt1 from the database,and now how could I check if the user is typing each character into combobox2 will display the similar company name on the combobox?

      I am not sure if I understand your question Do you want to auto search (Auto Complete) the results from the combobox? Meaning when you press 'A', it will fetch all the combo items starting with 'A' and so on.


      Mubashir Senior Engineer Storan Technologies Inc, USA Every job is a self portrait of the person who did it.

      D 1 Reply Last reply
      0
      • _ _mubashir

        drexler_kk wrote:

        I have select all the client company into dt1 from the database,and now how could I check if the user is typing each character into combobox2 will display the similar company name on the combobox?

        I am not sure if I understand your question Do you want to auto search (Auto Complete) the results from the combobox? Meaning when you press 'A', it will fetch all the combo items starting with 'A' and so on.


        Mubashir Senior Engineer Storan Technologies Inc, USA Every job is a self portrait of the person who did it.

        D Offline
        D Offline
        drexler_kk
        wrote on last edited by
        #3

        Yes,thats what I wish the combobox can auto showout all the stuff that match the user type drop down inside the combobox. Do you have any sample how should I do it? Thanks for replying.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups