Try
Dgrd.Rows.Clear()
ItDataset.Clear()
Flt = "SELECT * FROM TransView WHERE TRACom = N'" & Trim$(T10ID.Text) & "'" Order By TRAID"
ItDataset = GeneralDataManager.InquireData(ItDataset, Flt, "TransView")
If Me.BindingContext(ItDataset, "TransView").Count > 0 Then
For I As Integer = 0 To ItDataset.Tables("TransView").Rows.Count - 1
Dim row As String() =
{ItDataset.Tables("TransView").Rows(I).Item("TRAID"),
ItDataset.Tables("TransView").Rows(I).Item("Sender"),
ItDataset.Tables("TransView").Rows(I).Item("Recever"),
ItDataset.Tables("TransView").Rows(I).Item("TRAValue"),
ItDataset.Tables("TransView").Rows(I).Item("CurrnceyName"),
ItDataset.Tables("TransView").Rows(I).Item("TRADT"),
ItDataset.Tables("TransView").Rows(I).Item("OFCEName")}
Dgrd.Rows.Add(row)
End If
Next
TXTGREDTotal.Text = Dgrd.RowCount - 1
End If
Catch ex As Exception
Exit Sub
End Try
我有布尔AS(ItDataset.Tables(" TransView")。行(I).Item(" TRAYesORNo")) 我如何将此布尔值转换为字符串并将其添加到我的Datagridview?
答案 0 :(得分:0)
您不必将其转换为String
。只需将源列绑定到DataGridViewTextBoxColumn
而不是默认的DataGridViewCheckBoxColumn
。为此,请在设计器的网格中添加一个文本框列,并将其DataPropertyName
设置为源列的名称。现在,绑定时不会创建新列,您将看到文本" True"或"错误"而不是一个复选框。
答案 1 :(得分:0)
我找到答案:
Dim TRAYesORNo As String = ""
Try
Dgrd.Rows.Clear()
ItDataset.Clear()
Flt = "SELECT * FROM TransView WHERE TRACom = N'" & Trim$(T10ID.Text) & "'" Order By TRAID"
ItDataset = GeneralDataManager.InquireData(ItDataset, Flt, "TransView")
If Me.BindingContext(ItDataset, "TransView").Count > 0 Then
For I As Integer = 0 To ItDataset.Tables("TransView").Rows.Count - 1
If ItDataset.Tables("TransView").Rows(I).Item("TRAYesORNo") = False Then
TRAYesORNo = "YES"
Else
TRAYesORNo = "NO"
End If
Dim row As String() =
{ItDataset.Tables("TransView").Rows(I).Item("TRAID"),
ItDataset.Tables("TransView").Rows(I).Item("Sender"),
ItDataset.Tables("TransView").Rows(I).Item("Recever"),
ItDataset.Tables("TransView").Rows(I).Item("TRAValue"),
ItDataset.Tables("TransView").Rows(I).Item("CurrnceyName"),
ItDataset.Tables("TransView").Rows(I).Item("TRADT"),
ItDataset.Tables("TransView").Rows(I).Item("OFCEName")}
Dgrd.Rows.Add(row)
End If
Next
TXTGREDTotal.Text = Dgrd.RowCount - 1
End If
Catch ex As Exception
Exit Sub
End Try