through C # I am creating a program that manages ambulances, I am trying to create a list with the events and active missions, this data must be taken from a mysql database, I have tried to see many "tutorials", but none explained what I needed, how do you think I can do something like this?
in addition to displaying the data, if I click twice it should open the event or mission to me depending on where I click, (the icons are also buttons that should only be visible if there is a data)
just a tip! I'm not asking you to write the code for me!!!
EDIT: I managed to get the data from mysql, that you know is it possible to place the data in specific columns?
CodePudding user response:
It is difficult to guide you through such unspecific question, but I'll try some hints.
- You said you have data from MySQL
- Fill a
DataTable(another way is to useBindingSource) - Assign
DataTableas aDataSourceof yourDataGridViewgrid. - You can edit columns in the
DataGridViewusing UI in VS, or you can do it programatically. First is easier, just note that if you at any stage provide Nothing as a data source, you'll loose column headers. - For event fired on
DataGridViewRow, click on the grid in Designer, click on events in the Properties pane, findDatagridviewRow_DoubleClickand double click the line, to create associated method - FIll in the code into the even method. Use
DataGridView.SelectedRows(0)to get selected row and it's index. If you want to "open it" create a modal dialog or what you want for displaying the content.
