Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How can i detect DataGridView.SelectedRows pass in 2 for
Message
From
19/08/2011 12:26:14
 
 
To
19/08/2011 03:47:15
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
VB 9.0
Miscellaneous
Thread ID:
01521317
Message ID:
01521354
Views:
39
Hi Alex,

SelectedRows should work.However, the user must select the rows such that the entire row is selected, not just one cell. First be sure that that is where your problem is. If entire rows are being selected and you still do not get anything in the SelectedRows collection, then there is another problem elsewhere.

Could you verify this?

~~Bonnie




>Hi all ,
> I use vb.net ,two form, button and datagridview . In main form, my datagridview has some of DataGridViewCheckBoxColumn (column type).
>I want to click the button will show the option form, it has some of checkbox can relate the main form DataGridViewCheckBoxColumn .
> If the user Selected the Rows in main form, and then show the option form to update all of DataGridView cell value.
>But i write the below function , it can't detect the DataGridView.SelectedRows.,so break my for loop function. How can i do? Thank you !!!
>
>
>'MainForm function
>       
>    Private Sub BtnBatch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnBatch.Click
>        BatchGrant.ShowDialog()
>    End Sub
>
>    Public Sub updateDatagridviewRecords()
>        For Each r As DataGridViewRow In AccessrightDataGridView.SelectedRows                  'In this can't detect my seleted rows?
>            r.Cells(4).Value = OptionForm.CheckBoxCanass.Checked
>            r.Cells(5).Value = OptionForm.CheckBoxCannew.Checked
>            r.Cells(6).Value = OptionForm.CheckBoxcanmdy.Checked
>            r.Cells(7).Value = OptionForm.CheckBoxcandel.Checked
>            r.Cells(8).Value = OptionForm.CheckBoxcanprn.Checked
>            r.Cells(9).Value = OptionForm.CheckBoxcanhld.Checked
>            r.Cells(10).Value = OptionForm.CheckBoxcanuhd.Checked
>            r.Cells(11).Value = OptionForm.CheckBoxviewcost.Checked
>            r.Cells(12).Value = OptionForm.CheckBoxViewprice.Checked
>            r.Cells(13).Value = OptionForm.CheckBoxCanexp.Checked
>        Next
>    End Sub
>
>
>'OptionForm
>
>    Private Sub BtnGrant_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnGrant.Click
>        MainForm.updateDatagridviewRecords()
>    End Sub
>
>
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform