VB 中创建表格(1)

VB 中创建表格(1),第1张

概述VB 中创建表格(1)

下面是内存溢出 jb51.cc 通过网络收集整理的代码片段。

内存溢出小编现在分享给大家,也给大家做个参考。

Public Class Form1 inherits System.windows.Forms.FormPrivate Sub Form1_Load(ByVal sender As System.Object,ByVal e As System.EventArgs)_Handles MyBase.LoadEnd SubPrivate Sub button1_Click(ByVal sender As System.Object,ByVal e As_System.EventArgs) Handles button1.ClickDim table1 As Datatabletable1 = New Datatable("Customers")'creating a table named CustomersDim Row1,Row2,Row3 As DaTarow'declaring three rows for the tableTryDim name As DataColumn = New DataColumn("name")'declaring a column named namename.DataType = System.Type.GetType("System.String")'setting the datatype for the columntable1.Columns.Add(name)'adding the column to tableDim Product As DataColumn = New DataColumn("Product")Product.DataType = System.Type.GetType("System.String")table1.Columns.Add(Product)Dim Location As DataColumn = New DataColumn("Location")Location.DataType = System.Type.GetType("System.String")table1.Columns.Add(Location)Row1 = table1.NewRow()'declaring a new rowRow1.Item("name") = "Reddy"'filling the row with values. Item property is used to set the fIEld value.Row1.Item("Product") = "Notebook"'filling the row with values. adding a productRow1.Item("Location") = "Sydney"'filling the row with values. adding a locationtable1.Rows.Add(Row1)'adding the completed row to the tableRow2 = table1.NewRow()Row2.Item("name") = "Bella"Row2.Item("Product") = "Desktop"Row2.Item("Location") = "AdelaIDe"table1.Rows.Add(Row2)Row3 = table1.NewRow()Row3.Item("name") = "Adam"Row3.Item("Product") = "PDA"Row3.Item("Location") = "Brisbane"table1.Rows.Add(Row3)CatchEnd TryDim ds As New DataSet()ds = New DataSet()'creating a datasetds.tables.Add(table1)'adding the table to dataset DataGrID1.SetDataBinding(ds,"Customers")'binding the table to datagrIDEnd SubEnd Class 

以上是内存溢出(jb51.cc)为你收集整理的全部代码内容,希望文章能够帮你解决所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

总结

以上是内存溢出为你收集整理的VB 中创建表格(1)全部内容,希望文章能够帮你解决VB 中创建表格(1)所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/1274354.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-08
下一篇 2022-06-08

发表评论

登录后才能评论

评论列表(0条)

保存