DataGridView列VB.NET中的单选按钮

DataGridView列VB.NET中的单选按钮,vb.net,datagridview,radio-button,Vb.net,Datagridview,Radio Button,有人知道如何在Datagrid视图列中添加单选按钮吗??我需要在单个单元格中设置三个单选按钮。您必须为DataGridView创建自己的单元格和列。这有点棘手,但这里有MSDN的所有步骤: 这里我有一个简单的方法,使用选中的单选按钮 未选中的透明PNG图像 查看我的博客:how2doinvbdotnet.blogspot.in Public Class Form1 Dim ColType(,) As Integer Private Sub Form1_Load(ByVal sender

有人知道如何在Datagrid视图列中添加单选按钮吗??我需要在单个单元格中设置三个单选按钮。

您必须为
DataGridView
创建自己的单元格和列。这有点棘手,但这里有MSDN的所有步骤:


这里我有一个简单的方法,使用选中的单选按钮 未选中的透明PNG图像

查看我的博客:how2doinvbdotnet.blogspot.in

Public Class Form1 Dim ColType(,) As
   Integer Private Sub Form1_Load(ByVal sender As System.Object, ByVal e
   As System.EventArgs) _ Handles MyBase.Load With DataGridView1
   .RowCount = 5 .ColumnCount = 3 For i As Integer = 0 To .RowCount - 1
   .Rows(i).Cells(2) = New DataGridViewImageCell
   .Rows(i).Cells(2).Style.Alignment =
   DataGridViewContentAlignment.MiddleCenter .Rows(i).Cells(2).Value =
   My.Resources.RadioUnsel .Rows(i).Cells(2).Tag = 2 Next End With End
   Sub   Private Sub DataGridView1_CellClick(ByVal sender As Object,
   ByVal e As _System.Windows.Forms.DataGridViewCellEventArgs) Handles
   DataGridView1.CellClick With DataGridView1 If
   .Rows(e.RowIndex).Cells(e.ColumnIndex).Tag = 2 Then For i As Integer
   = 0 To .RowCount - 1 If e.RowIndex <> i Then .Rows(i).Cells(e.ColumnIndex).Value = My.Resources.RadioUnsel

Else
.Rows(i).Cells(e.ColumnIndex).Value = My.Resources.RadioButtonSel
End If
Next
End If
End With
End Sub
End Class
公共类Form1 Dim ColType(,)作为
整数私有子表单1_加载(ByVal发送方作为System.Object,ByVal e
作为System.EventArgs)\使用DataGridView1处理MyBase.Load
.RowCount=5.ColumnCount=3,i为整数=0到.RowCount-1
.Rows(i).Cells(2)=新的DataGridViewImageCell
.行(i).单元格(2).样式.对齐=
DataGridViewContentAlignment.MiddleCenter.Rows(i).Cells(2).Value=
My.Resources.RadioUnsel.Rows(i).Cells(2).Tag=2下一个端点加上End
Sub-Private Sub-DataGridView1_CellClick(ByVal sender作为对象,
ByVal e作为_System.Windows.Forms.DataGridViewCellEventArgs)句柄
DataGridView1.cell如果需要,请使用DataGridView1单击
.Rows(e.RowIndex).Cells(e.ColumnIndex).Tag=2,则i为整数
=0到.RowCount-1,如果e.RowIndex i,则为.Rows(i).Cells(e.ColumnIndex).Value=My.Resources.RadioUnsel
其他的
.Rows(i).Cells(e.ColumnIndex).Value=My.Resources.radiobuttonse
如果结束
下一个
如果结束
以
端接头
末级

在此处更新datagridview的代码,以获得良好的答案EA。。我知道。但我尝试编辑列属性。只有
datagridview复选框列
datagridview组合框列
<代码>Datagridview单选按钮列不在那里。我是vb.net的新手