Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How can i detect DataGridView.SelectedRows pass in 2 for
Message
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
VB 9.0
Divers
Thread ID:
01521317
Message ID:
01521645
Vues:
31
I may be way off base here but it sounds like what you're trying to do is have a method in a 2nd form called by ShowDialog() check the selected rows in a DataGridView on a calling form Is that right? I think you may be able to accomplish what you want if you pass an object reference to the 1st form into your 2nd form. You can use that object reference to get to the reference for the DataGridView.


>I already used .show but also can't to detect the before form DataGridView.SelectedRows method.
>Actually, i tested more day. I think DataGridView.SelectedRows only can detect in current form.
>So i give up it.
>But i want to still finish this function. In this time, i think other method.
> I only checked the DataGridView.SelectedRows in main form first, then user will leave the DataGridView,
>i will store the rows index in array and pass to option form. After user chick the option form (OptionForm.show) and do something.
>
>But i also some of technology problem. I don't know how can pass an array to other form store it and define a unknow array to pass , store.
>The below is not finish code.
>Anyone can give some of idea to me.....Thank you~~~
>
>
>Public Class MainForm
>  Public tempRowArray As ArrayList
>
>    Private Sub AccessrightDataGridView_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles AccessrightDataGridView.Leave
>        tempRowArray = New ArrayList
>        tempRowArray.Clear()
>        For Each r As DataGridViewRow In AccessrightDataGridView.SelectedRows
>            tempRowArray.Add(r.Index)
>        Next
>
>        OptionForm.AccessRightPassRowNo = tempRowArray.Count      ' (error)my problem in this, i don't know how to pass the unknow array number in right method
>        OptionForm.AccessRightPassRowArray = tempRowArray            '(error)my problem in this
>    End Sub
>
>    Private Sub BtnBatch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnBatch.Click
>        OptionForm.Show()    
>    End Sub
>---------------------------------------------------------------------------------------------------------------------------------------------------
>Public Class BatchGrant
>    Dim AccessRightPassRowsCount As Integer       ' (error)my problem in this, i don't know how to define the unknow array number in right method
>    Dim AccessRightPassRows() As String               ' (error)my problem in this
>
>
>    Private Sub BtnGrant_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnGrant.Click
>        updateDatagridviewRecords()
>    End Sub
>
>    Public Sub updateDatagridviewRecords()
>      '  For i = 0 To tempRowArray .Count - 1
>       '     MainForm.AccessrightDataGridView.Rows(tempRowArray (i)).Cells(4).Value = CheckBoxCanass.Checked
>       '     MainForm.AccessrightDataGridView.Rows(tempRowArray (i)).Cells(5).Value = CheckBoxCannew.Checked
>       '     MainForm.AccessrightDataGridView.Rows(tempRowArray (i)).Cells(6).Value = CheckBoxcanmdy.Checked
>       '     MainForm.AccessrightDataGridView.Rows(tempRowArray (i)).Cells(7).Value = CheckBoxcandel.Checked
>       '     MainForm.AccessrightDataGridView.Rows(tempRowArray (i)).Cells(8).Value = CheckBoxcanprn.Checked
>       '     MainForm.AccessrightDataGridView.Rows(tempRowArray (i)).Cells(9).Value = CheckBoxcanhld.Checked
>       '     MainForm.AccessrightDataGridView.Rows(tempRowArray (i)).Cells(10).Value = CheckBoxcanuhd.Checked
>       '     MainForm.AccessrightDataGridView.Rows(tempRowArray (i)).Cells(11).Value = CheckBoxviewcost.Checked
>       '     MainForm.AccessrightDataGridView.Rows(tempRowArray (i)).Cells(12).Value = CheckBoxViewprice.Checked
>        '    MainForm.AccessrightDataGridView.Rows(tempRowArray (i)).Cells(13).Value = CheckBoxCanexp.Checked
>        'Next
>    End Sub
>
>    Public Property AccessRightPassRowNo() As Integer       ' (error)my problem in this, i don't know how to pass and store the unknow array number in right method
>        Get                                                                           ' (error)
>            Return Me.AccessRightPassRowsCount                  ' (error)
>        End Get                                                                     ' (error)
>        Set(ByVal value As Integer)                                         ' (error)
>            Me.AccessRightPassRowsCount = value                  ' (error)
>        End Set                                                                      ' (error)
>    End Property                                                                   ' (error)
>
>    Public Property AccessRightPassRowArray() As String        ' (error)
>        Get                                                                               ' (error)
>            Return Me.AccessRightPassRows                               ' (error)
>        End Get                                                                           ' (error)              
>        Set(ByVal value(AccessRightPassRowsCount) As String)      ' (error)
>            Me.AccessRightPassRows = value()                                 ' (error)
>        End Set                                                                              ' (error)
>    End Property                                                                           ' (error)
>End Class
>
Linda Harmes
HiBit Technologies, Inc.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform