Home > Software engineering >  c # winform mysql data display
c # winform mysql data display

Time:07-14

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?

image here

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?

Program Code

CodePudding user response:

It is difficult to guide you through such unspecific question, but I'll try some hints.

  1. You said you have data from MySQL
  2. Fill a DataTable (another way is to use BindingSource)
  3. Assign DataTable as a DataSource of your DataGridView grid.
  4. You can edit columns in the DataGridView using 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.
  5. For event fired on DataGridViewRow, click on the grid in Designer, click on events in the Properties pane, find DatagridviewRow_DoubleClick and double click the line, to create associated method
  6. 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.
  • Related