[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Database/DataGrid/Listboxes - how to link together?

Posted on 2004-11-15
Medium Priority
Last Modified: 2010-04-23
I've got a form with a datagrid and a few listboxes on it.
The DataGrid is connected to the DataSet
The ListBoxes are connected to fields in the same table as the DataGrid.
When I change records by clicking on the DataGrid the listboxes dont change to reflect the data in the current record.

How can I make the listboxes update to reflect the current record when the DataGrid record changes?
Question by:Matrix1000
1 Comment

Accepted Solution

MsFox earned 1500 total points
ID: 12590485
Dim currentrow, currentcell As Integer
currentrow = DataGrid1.CurrentRowIndex
currentcell = DataGrid1.CurrentCell.ColumnNumber
ListBox1.SelectedIndex =DataGrid1.Item(currentrow, 0)
ListBox2.SelectedIndex =DataGrid1.Item(currentrow, 1)

if the value of the listboxes' selectedindex is not displayed in the datagrid, you could put them in the datagrid and make it invisible.


Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Loops Section Overview
Suggested Courses
Course of the Month19 days, 14 hours left to enroll

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question