تابعنا على اليوتيوب
لكي يصلك كل جديد
Subscribe to the YouTube channel
تقديم الدروس التكنولوجية المجانية
بناء أنظمة للتجار بحسب المتطلبات
التعليم الخاص
تقديم دراسات الجدوى

Tutorials VB.Net  |   اكود وتطبيقات برمجية متنوعة Code and applications   Multiple programming
إضافة زر Button داخل الأداة DataGridView
تأريخ الإضافة : 13.09.2014
تطبيقات برمجية Software applications
قم بإرسال الموضوع عبر الفيس بوك

التفاصيل :
إضافة زر Button داخل الأداة DataGridView

 

 

 

Imports System.Data.SqlClient
Public Class Form1
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        DataGridView1.ColumnCount = 3
        DataGridView1.Columns(0).Name = "Product ID"
        DataGridView1.Columns(1).Name = "Product Name"
        DataGridView1.Columns(2).Name = "Product_Price"
 
        Dim row As String() = New String() {"1", "Product 1", "1000"}
        DataGridView1.Rows.Add(row)
        row = New String() {"2", "Product 2", "2000"}
        DataGridView1.Rows.Add(row)
        row = New String() {"3", "Product 3", "3000"}
        DataGridView1.Rows.Add(row)
        row = New String() {"4", "Product 4", "4000"}
        DataGridView1.Rows.Add(row)
 
        Dim btn As New DataGridViewButtonColumn()
        DataGridView1.Columns.Add(btn)
        btn.HeaderText = "Click Data"
        btn.Text = "Click Here"
        btn.Name = "btn"
        btn.UseColumnTextForButtonValue = True
 
    End Sub
    Private Sub DataGridView1_CellClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellClick
        If e.ColumnIndex = 3 Then
            MsgBox(("Row : " + e.RowIndex.ToString & "  Col : ") + e.ColumnIndex.ToString)
        End If
    End Sub
End Class

Oh snap! We just showed you a modal..

Because we can

Cool huh? Ok, enough teasing around..

Go to our W3.CSS Tutorial to learn more!

Modal footer