Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27349

problem in work with datagridview

$
0
0
hi
i have 5 datagridview in my form . i create a Sub to fill all these 3 datagridview.i want this sub also set the visibility of 3 first row of these datagridviews to false . here is my code :
Code:

Public cn As New System.Data.SqlClient.SqlConnection
Public DA As SqlDataAdapter
Public DT As New DataTable()
Public SqlCommandBuilder As SqlCommandBuilder

Public Sub FillDataGridViews(ByVal dgv As DataGridView)
        cn.ConnectionString = "Data Source=pooyan-pc\SQLEXPRESS;Initial Catalog=Faravaresh Produce Control;UID=pooya1072;password=ahmadreza"
        NFFeedDataAdapter = New SqlDataAdapter("select * from T1", cn)
        NFFeedDataAdapter.FillSchema(NFFeedDataTable, SchemaType.Source)
        NFFeedDataAdapter.Fill(NFFeedDataTable)
        SqlCommandBuilder = New SqlCommandBuilder(NFFeedDataAdapter)
        dgv.DataSource = NFFeedDataTable
        dgv.CurrentCell = Nothing
        dgv.Rows(0).Visible = False
        dgv.Rows(1).Visible = False
        dgv.Rows(2).Visible = False
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        FillDataGridViews(dgv1)
        FillDataGridViews(dgv2)
        FillDataGridViews(dgv3)
End Sub

the problem is that in 2 first dgv (dgv1 and dgv2) the visibility of first row (rows(0)) dont set to false.the visibility of rows(1) and rows(2) is set to false and is ok . only the visibility of all 3 rows of last dgv (dgv3) is false and ok.
can you help me ?

Viewing all articles
Browse latest Browse all 27349

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>