VB中的DataGridView中的添加行和列是否有任何建议

发布于 2025-02-08 21:57:24 字数 637 浏览 3 评论 0原文

到目前为止,这是可能的代码,

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles 
Button1.Click
    Dim tab As Integer = TextBox1.Text
    Dim row As Integer = TextBox2.Text
    Dim i, j As Integer
    DataGridView1.ColumnCount = tab
    Dim q As Integer = 0
    For i = 1 To tab
        DataGridView1.Columns(q).Name = ""
        For j = 1 To row
              DataGridView1.Rows().Add({i & "x" & j & "=" & (i * j)})
              
        Next j
    Next i
End Sub

我收到的输出就是这样: 在此处输入图像描述

This is may code so far

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles 
Button1.Click
    Dim tab As Integer = TextBox1.Text
    Dim row As Integer = TextBox2.Text
    Dim i, j As Integer
    DataGridView1.ColumnCount = tab
    Dim q As Integer = 0
    For i = 1 To tab
        DataGridView1.Columns(q).Name = ""
        For j = 1 To row
              DataGridView1.Rows().Add({i & "x" & j & "=" & (i * j)})
              
        Next j
    Next i
End Sub

the output i get was like this :
enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

明天过后 2025-02-15 21:57:29

问题不清楚,但是从我在评论中阅读的内容中,您应该问如何在DataGridView中添加1x1至1x4。如果是这样,您只需要向上滚动即可查看它或尝试放大数据杂志,对不起,如果我错误的解释。

the question is not clear, but from what I read in the comment you should be asking how to add the 1x1 to 1x4 in the datagridview. If so then you only need to scroll up to see it or try enlarging your datagridview, sorry if i interpret wrongly.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文