General information
Category:
Coding, syntax and commands
Title:
How can i store and pass arraylist or array to other form?
I use vb.net and datagridview.
I want to check 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 OptionForm
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
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only