DataGridVIEW checkbox and multiple forms

Xaphann

Member
Joined
Jun 17, 2011
Messages
5
Programming Experience
Beginner
Hi
I have a datagrid that is populated by a user starting and ending value. Each record has two check boxes. Here is an example;

VB.NET:
Starting:  ABC001
 Ending:  ABC004

 Datagrid;

 Value         Missing           Accept
 ABC001        checkbox        checkbox
 ABC002        checkbox        checkbox
 ABC003        checkbox        checkbox
 ABC004        checkbox        checkbox

I am having two problems with it.

First problem; The user can not click the check boxes even though I have set the datagrid "Enable Editing". What I need is for the user to be able to click one the check boxes per row but not both. Also the user should not be able to edit the "Value".

The second problem; The user can move between different forms (forms that do not display the datagrid). Now what I did is create a class;
VB.NET:
 Public Class Class1
 Public userData  As DataGridView
End Class

The code Load of the form that has datagrid

VB.NET:
     Private Sub form1Form_Load(sender As Object, e As System.EventArgs) Handles Me.Load
       Dim startValue As Integer = CInt(New Regex("\d+").Match(bo.startingSerialNumber).Value)
        Dim endValue As Integer = CInt(New Regex("\d+").Match(bo.endingSerialNumber).Value)


        For x As Integer = startValue To endValue
           userDataGrid.Rows.Add(New Object() {seriesID & x.ToString(), False, False})
        Next
   class1.userData = userDataGrid.DataSource


End Sub

This works fine going back and forth from form to form. The issue is if the user puts in a new start and end values. The new values will displayed in the datagrid but the old values will not. For example;

User enters;
VB.NET:
 Starting:  ABC001
 Ending:  ABC004

 Datagrid;

 Value         Missing           Accept
 ABC001        checkbox        checkbox
 ABC002        checkbox        checkbox
 ABC003        checkbox        checkbox
 ABC004        checkbox        checkbox

User leaves the datagrid form, comes back the datagrid is fine. Then user leaves the form enters in a new values of;

VB.NET:
 Starting:  DEF001
 Ending:  DEF004

 Datagrid;

 Value         Missing           Accept
 DEF001        checkbox        checkbox
 DEF002        checkbox        checkbox
 DEF003        checkbox        checkbox
 DEF004        checkbox        checkbox

That shouldn't happen. What datagrid should look like is this;

VB.NET:
 Datagrid;

 Value         Missing           Accept
 ABC001        checkbox        checkbox
 ABC002        checkbox        checkbox
 ABC003        checkbox        checkbox
 ABC004        checkbox        checkbox
 DEF001        checkbox        checkbox
 DEF002        checkbox        checkbox
 DEF003        checkbox        checkbox
 DEF004        checkbox        checkbox

Thanks for the help
 
Back
Top