简体   繁体   中英

VB .net: How to put a value on a checkbox (databese: MS Access)

I just need a little help for my homework. I did my best think about the logic but it's too late. So basically, this is what I need to do :

If I'll check the checkbox 1 it will automatically input "100" on the second column of my datagridview and also if I'll check checkbox 2 it will also input "50" on my 3rd column.



[ ] Fee1 (checkbox1) = $100
[ ] Fee2 (checkbox2) = $50


The output should look like this:

StudentFeeTableGridView

Name| Fee 1| Fee 2
Jack | 0 | 50
Jill | 100 | 0
John | 100 | 0
Jose | 0 | 50


Thank you so much guys for helping! I owe you.

Set DataGridView.SelectionMode=FullRowSelect and use CheckedChanged event. With code below, values will be inserted to cells in selected row:

  • For 1 checkbox:

If (Fee1.checked=True) Then dataGridView1.CurrentRow.Cells("Fee1").Value="100"

  • For 2 checkbox:

If (Fee2.checked=True) Then dataGridView1.CurrentRow.Cells("Fee2").Value="50"

Note : .Cells("Fee1") and .Cells("Fee2") must be valid column name in DataGridView.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM