•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the VB.NET section within the Software Development category of DaniWeb, a massive community of 456,233 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,767 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our VB.NET advertiser: Programming Forums
Views: 425 | Replies: 2
![]() |
' while form load bind the data in datagird control
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim con As SqlConnection = New SqlConnection("server=shailu;uid=sa;pwd=;database=pubs")
Dim sadapt As SqlDataAdapter = New SqlDataAdapter("select * from account", con)
Dim ds As DataSet = New DataSet
sadapt.Fill(ds)
DataGrid1.DataSource = ds.Tables(0)
End Sub
'Bind the data in datagrid control by accountcode from the user through textbox
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim con As SqlConnection = New SqlConnection("server=shailu;uid=sa;pwd=;database=pubs")
Dim sadapt As SqlDataAdapter = New SqlDataAdapter("select * from account where accountcode='" & TextBox1.Text & "'", con)
Dim ds As DataSet = New DataSet
sadapt.Fill(ds)
DataGrid1.DataSource = ds.Tables(0)
End Sub
'While change values in a cell(account code) required data will bind
Private Sub DataGrid1_CurrentCellChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGrid1.CurrentCellChanged
Dim con As SqlConnection = New SqlConnection("server=shailu;uid=sa;pwd=;database=pubs")
Dim sadapt As SqlDataAdapter = New SqlDataAdapter("select * from account where accountcode like '%" & DataGrid1.Item(DataGrid1.CurrentRowIndex, 0) & "%'", con)
Dim ds As DataSet = New DataSet
sadapt.Fill(ds)
DataGrid1.DataSource = ds.Tables(0)
End Sub
Best Regards,
shailu
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim con As SqlConnection = New SqlConnection("server=shailu;uid=sa;pwd=;database=pubs")
Dim sadapt As SqlDataAdapter = New SqlDataAdapter("select * from account", con)
Dim ds As DataSet = New DataSet
sadapt.Fill(ds)
DataGrid1.DataSource = ds.Tables(0)
End Sub
'Bind the data in datagrid control by accountcode from the user through textbox
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim con As SqlConnection = New SqlConnection("server=shailu;uid=sa;pwd=;database=pubs")
Dim sadapt As SqlDataAdapter = New SqlDataAdapter("select * from account where accountcode='" & TextBox1.Text & "'", con)
Dim ds As DataSet = New DataSet
sadapt.Fill(ds)
DataGrid1.DataSource = ds.Tables(0)
End Sub
'While change values in a cell(account code) required data will bind
Private Sub DataGrid1_CurrentCellChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGrid1.CurrentCellChanged
Dim con As SqlConnection = New SqlConnection("server=shailu;uid=sa;pwd=;database=pubs")
Dim sadapt As SqlDataAdapter = New SqlDataAdapter("select * from account where accountcode like '%" & DataGrid1.Item(DataGrid1.CurrentRowIndex, 0) & "%'", con)
Dim ds As DataSet = New DataSet
sadapt.Fill(ds)
DataGrid1.DataSource = ds.Tables(0)
End Sub
Best Regards,
shailu
![]() |
•
•
•
•
•
•
•
•
DaniWeb VB.NET Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- can someone plz help me with this? (Visual Basic 4 / 5 / 6)
- I NEED SUPPORT **"IMPORTANT"** PLZ HELP (Windows NT / 2000 / XP / 2003)
- Deleting characters function ( with just one parameter) (C)
- please check this hjt log need help (Viruses, Spyware and other Nasties)
- Windows media player (Windows NT / 2000 / XP / 2003)
- IE not working...PLZ help :cry: (Web Browsers)
- PLZ help it's urgent! (Web Browsers)
- plz help ppl...... (Computer Science and Software Design)
Other Threads in the VB.NET Forum
- Previous Thread: Confusing directions
- Next Thread: VB 6 and Oracle to VB Net and Oracle Issues


Linear Mode