I am a beginner in C#. I have a Windows Forms named ClientTransaction and ServiceDetails. I made a DataGridView and it has a view button in a row where when you click it, it will generate a servicedetail form. I want the Values in Client Transaction from the datagridview to be passed in a service detail.
Client Transaction Form:
Once it click the view, will proceed to Service Details Form
Service Details Form mock up only
I try this codes
private void ClientTransaction_Load(object sender, EventArgs e)
{
DataGridViewButtonColumn viewBtn = new DataGridViewButtonColumn();
viewBtn.HeaderText = "Action";
viewBtn.Text = "View";
viewBtn.Name = "btnView";
viewBtn.UseColumnTextForButtonValue = true;
reservedGrid.Columns.Add(viewBtn);
}
private void reservedGrid_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
var senderGrid = (DataGridView)sender;
if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn &&
e.RowIndex >= 0)
{
//TODO - Button Clicked - Execute Code Here
ServiceDetail viiew = new ServiceDetail();
viiew.Show();
}
}
It works on proceeding on another form but I still finding its ways on passing the data in another form from the value of the every row from client transaction in datagridview will be pass in a service detail form as you can see in the screenshots above. Thank you!
Client Transaction Table
id
INT AUTO_INCREMENT PRIMARY KEY,
client_id
INT NOT NULL,
status
VARCHAR(20) NOT NULL,
total_amt
DOUBLE (7,2),
trans_date
timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
Service Detail Table
id
INT AUTO_INCREMENT PRIMARY KEY,
client_transaction_id
INT NOT NULL,
barber_id
INT NOT NULL,
service_id
INT NOT NULL,
added_on
timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP