摘要:
Imports SystemImports System.IO.PortsPublic Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load '获取计算机有效串口 Dim ports As String() = SerialPort.GetPortNames() '必须用命名空间,用SerialPort,获取计算机的有效串口 Dim port As String ... 阅读全文
摘要:
Imports SystemImports System.IO.PortsPublic Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load '获取计算机有效串口 Dim ports As String() = SerialPort.GetPortNames() '必须用命名空间,用SerialPort,获取计算机的有效串口 Dim port As String For Each port In port 阅读全文
摘要:
1、右键点击DataGridView,选择编辑列,如图2、为每个列设置排序方式,点击“sortMode”,选择排序方式,一般采用默认排序方式即可,即“automatic”,表示可以倒序,也可以正序 阅读全文
摘要:
1、在窗体设计器中,单击DataGridView控件(不要双击,将会打开窗体的代码页);2、在属性窗口中,打开AlternatingRowsDefaultCellStyle属性;3、在外观中,点击BackColor属性的下拉箭头,显示CellStyleBuilder对话框,选择一个与当前颜色不同的颜色(默认是白色),可以选择紫色等,然后点击确定按钮。4、可以设置选中某一单元格或一行的显示颜色,单击“selectionBackColour”的箭头,进行选择合适的颜色 阅读全文
摘要:
有两种方法:(1):你在查询的那句SQL代码时: string sql = "select userName as 姓名,userNum as 编号,userClass as 所属部门 from userInfo";(显示的时候就是中文了)。(2):界面操作,把DataGridView控件拖放在窗体中,就看到DataGridView控件的右上角有个小三角,单击小三角,出现了“DataGridView任务”,或是直接右键DataGridView控件,选择“编辑列”;在弹出的“编辑列窗口中”,点“添加”,要几列就添加几列,在左边的“选定的列”中选择一列,然后再右边的“未绑定列属 阅读全文
摘要:
利用DataTable本身本身的个合并方法。Dim conn As New SqlConnection Dim rs As New SqlDataAdapter Dim ds As New DataSet Private Function connect_db() As SqlConnection Dim constr As String constr = "Server=PC-201105311336\SQLEXPRESS;uid=sa;pwd=123456;database=jiaxiaoai" 'rs.Fill(dataset, "student&q 阅读全文
摘要:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Dim sql As String Dim dt As New DataTable Time2 = "11:14:00" '设置定时的时间,24小时制 ,应该放在出事加载程序中 Timer1.Interval = 1000 '设置计时器每秒钟运行一次 ,应该放在出事加载程序中 Timer1.Enabled = True '计时器开始运行 ,应该放 阅读全文
摘要:
1 关于 通过SqlDataAdapter 插入DataSet中的数据到数据库 有两种方法: 2 3 (1) 4 5 使用SqlCommandBuilder 6 7 SqlConnection conn=new SqlConnection(); 8 conn.ConnectionString=ConfigurationManager.ConnectionStrings["TestDBConnectionString"].ConnectionString; 9 conn.Open();10 SqlCommand cmd=new SqlCommand();11 cmd.Comm 阅读全文
摘要:
View Code 1 Public Sub connect() 2 Dim pass As Boolean 3 pass = False 4 Dim conn As New SqlConnection 5 Dim rs As New SqlCommand 6 Dim dataread As SqlDataReader 7 Dim constr As String 8 'Dim i As Integer 9 Dim sql As String10 constr = "server=PC-201105311336\SQLEXPRESS;Uid=sa;Pwd=123456;Dat 阅读全文
摘要:
代码如下:View Code 1 Public Class 全部学生信息 2 3 Dim conn As New SqlConnection 4 Dim rs As New SqlDataAdapter 5 'Dim dt As New DataTable 6 Dim ds As New DataSet 7 8 Public Function connect_db() As SqlConnection 9 Dim constr As String 10 constr = "Server=PC-201105311336\SQLEXPRESS;uid=sa;pwd=123456; 阅读全文