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. urgent help needed in DataGrid & ComboBox

urgent help needed in DataGrid & ComboBox

Scheduled Pinned Locked Moved Visual Basic
csharpcssdatabasehelp
11 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.
  • C costavo

    hello all, I have a data grid in vb.net 2003 connected to the database what I need is to select specific data by choosing the employeeID using comboBox e.g: comboBox: a.srour datagrid: view a.srour details ....

    C Offline
    C Offline
    Christian Graus
    wrote on last edited by
    #2

    There are definately articles on the site for putting a combo box inside a data grid.

    Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

    C 1 Reply Last reply
    0
    • C Christian Graus

      There are definately articles on the site for putting a combo box inside a data grid.

      Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

      C Offline
      C Offline
      costavo
      wrote on last edited by
      #3

      thank u Christian Graus, but what i want that the combobox outside the datagrid, it is a kind of filter. select a value from comboBox for its details to be viewed in the datagrid srour_costavo@hotmail.com

      C 1 Reply Last reply
      0
      • C costavo

        thank u Christian Graus, but what i want that the combobox outside the datagrid, it is a kind of filter. select a value from comboBox for its details to be viewed in the datagrid srour_costavo@hotmail.com

        C Offline
        C Offline
        Christian Graus
        wrote on last edited by
        #4

        Oh, OK. That's even easier. You just handle the index changed event on the combo, and run fresh SQL to fill the grid based on the selection. The combobox lets you store a value that's associated with each string entry, so you can hide the Id you need in there.

        Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

        C 1 Reply Last reply
        0
        • C Christian Graus

          Oh, OK. That's even easier. You just handle the index changed event on the combo, and run fresh SQL to fill the grid based on the selection. The combobox lets you store a value that's associated with each string entry, so you can hide the Id you need in there.

          Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

          C Offline
          C Offline
          costavo
          wrote on last edited by
          #5

          ok man but the real problem is in the syntax, the concept is understood, the help I need is syntax help would u do that srour_costavo@hotmail.com

          C 1 Reply Last reply
          0
          • C costavo

            ok man but the real problem is in the syntax, the concept is understood, the help I need is syntax help would u do that srour_costavo@hotmail.com

            C Offline
            C Offline
            Christian Graus
            wrote on last edited by
            #6

            To be honest, I can't. How are you accessing your database ? What sort of database is it ? What value do you want to use to select your values ? What is your database schema ? I can't provide more direct help without all of that info, and if you can't do it, I'm wondering which bit you're stuck on ? Can you access your database at all ?

            Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

            C 1 Reply Last reply
            0
            • C Christian Graus

              To be honest, I can't. How are you accessing your database ? What sort of database is it ? What value do you want to use to select your values ? What is your database schema ? I can't provide more direct help without all of that info, and if you can't do it, I'm wondering which bit you're stuck on ? Can you access your database at all ?

              Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

              C Offline
              C Offline
              costavo
              wrote on last edited by
              #7

              ''The SQL select Command Private Sub conn() dt = ProfileDAO.ExecuteStrDt("SELECT [ComputerName], [Comming], [Leaving], [TotalTime], [IncludeTotalTime], [OverTime],[overtimeckh] FROM [HR].[dbo].[WorkingHours] ) DGtimeS.DataSource = dt End Sub ' I am Accessing the db without problems ' the comboBox is also connected to db and retriving data without problems Private Sub ttt1() Dim FullName1 As String Dim i As Integer dt = ProfileDAO.ExecuteStrDt("Select EmployeeID, FirstName, fatherName, LastName from Employees order by FirstName") Me.CmbEmployees.Items.Clear() With CmbEmployees For i = 0 To dt.Rows.Count - 1 FullName1 = dt.Rows(i)(1) & " " & dt.Rows(i)(2) & " " & dt.Rows(i)(3) .Items.Add(New Mylist(FullName1, dt.Rows(i)(0))) Next End With End Sub 'what i want is to connect the combo box and the data grid 'vb 2003 & sql 2000 is that possible & if u give me ur email i may send u code of the app

              C 1 Reply Last reply
              0
              • C costavo

                ''The SQL select Command Private Sub conn() dt = ProfileDAO.ExecuteStrDt("SELECT [ComputerName], [Comming], [Leaving], [TotalTime], [IncludeTotalTime], [OverTime],[overtimeckh] FROM [HR].[dbo].[WorkingHours] ) DGtimeS.DataSource = dt End Sub ' I am Accessing the db without problems ' the comboBox is also connected to db and retriving data without problems Private Sub ttt1() Dim FullName1 As String Dim i As Integer dt = ProfileDAO.ExecuteStrDt("Select EmployeeID, FirstName, fatherName, LastName from Employees order by FirstName") Me.CmbEmployees.Items.Clear() With CmbEmployees For i = 0 To dt.Rows.Count - 1 FullName1 = dt.Rows(i)(1) & " " & dt.Rows(i)(2) & " " & dt.Rows(i)(3) .Items.Add(New Mylist(FullName1, dt.Rows(i)(0))) Next End With End Sub 'what i want is to connect the combo box and the data grid 'vb 2003 & sql 2000 is that possible & if u give me ur email i may send u code of the app

                C Offline
                C Offline
                Christian Graus
                wrote on last edited by
                #8

                OK, so you have the employee Id in your combobox item. Now, pull it out of there when a selection is made, and write your SQL with a where clause that uses this Id to get only the data you need, and bind it to your grid.

                Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

                C 1 Reply Last reply
                0
                • C Christian Graus

                  OK, so you have the employee Id in your combobox item. Now, pull it out of there when a selection is made, and write your SQL with a where clause that uses this Id to get only the data you need, and bind it to your grid.

                  Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

                  C Offline
                  C Offline
                  costavo
                  wrote on last edited by
                  #9

                  I know that i am disturbing a lot, and i understood the concept very well but the real problem is that I DONT KNOW THE SYSNTAX to do what u are saying. my demand is the sentax bro. is that possible? srour_costavo@hotmail.com

                  C 1 Reply Last reply
                  0
                  • C costavo

                    I know that i am disturbing a lot, and i understood the concept very well but the real problem is that I DONT KNOW THE SYSNTAX to do what u are saying. my demand is the sentax bro. is that possible? srour_costavo@hotmail.com

                    C Offline
                    C Offline
                    Christian Graus
                    wrote on last edited by
                    #10

                    TWo things 1 - no way do I give out my email address 2 - I cannot give you exact syntax. Like I told you, unless I see the schema of the DB, I don't know what it is. Why can't you work out the syntax ? Is it the SQL that you have trouble with ? b/c the data access code doesn't really change.

                    Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

                    C 1 Reply Last reply
                    0
                    • C Christian Graus

                      TWo things 1 - no way do I give out my email address 2 - I cannot give you exact syntax. Like I told you, unless I see the schema of the DB, I don't know what it is. Why can't you work out the syntax ? Is it the SQL that you have trouble with ? b/c the data access code doesn't really change.

                      Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

                      C Offline
                      C Offline
                      costavo
                      wrote on last edited by
                      #11

                      please move my posts to vb.net forum if this is not the vb.net forum

                      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