
正文
vb.netcc的简单介绍
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
vb.net怎么使用cclink访问plc
读取的是什么PLC? CCLINK一般做不到你提出的这个需求的。
VB.NET中是可以监控PLC中的数据的,要知道PLC的通讯协议就可以监控了。
相关问答
Q1: VB.NET 泛函数 system.collections.generic.list(of textbox) 的使用问题!
Dim cc As String()vb.netcc,这样只是定义vb.netcc了一个数组类型vb.netcc的变量,它的值为Nothing,所以后面会出NullReferenceException。
定义数组要这么定义Dim cc(k) As String
还有你为什么要用参数k呢,可以通过list.Count来获得列表中元素的数量。
Private Function GetText(list As List(Of TextBox)) As String()
If list Is Nothing Then Throw New ArgumentNullException("list")
Dim k As Integer = list.Count - 1
Dim cc(k) As String
For i As Integer = 0 To k
cc(i) = list(i).Text
Next
Return cc
End Function
还有一些其他方法,比如用convertAll
Dim Texts = list.ConvertAll(Function(txt) txt.Text).ToArray
或者LINQ:
Dim ts = (From c In list Select c.Text).ToArray
ConvertAll返回类型就是List(Of T),LINQ返回类型是IEnumerable(OF T)。它们都有ToArray()方法来转化为数组,不过很多时候其实用不着转化成数组。
上面两种语法至少要VS2008才支持
Q2: VB.NET实例化类
可以,但是变量不能用ClassA或B来定义,可以用Object,或ClassA,ClassB的基类,,使用类的成员时,再把变量类型转换成相应的类
Q3: vb.net是什么
VB.net是微软最新平台技术vb.netcc,是.netframeworkSDKvb.netcc的一种语言。VB.net和VC#.net在功能上没有区别。编译以后生成vb.netcc的可执行文件被称为Assemblyvb.netcc,即
程序集
。
Q4: 关于VB.NET连接字符串
Dim da As String = "SELECT Count(检测项目) FROM b where 检测项目='cc'"
这句写错啦,你直接传送的是检测项目为字符串"cc"的参数,并不是你程序写的CC参数
改为:
Dim da As String = "SELECT Count(检测项目) FROM b where 检测项目='" cc "'"
建议通过程序组织的sql语句可以通过msgbox da 弹出来看看,这样你较容易查出是什么错误,较长的就用textbox1.text=da来看了,不过记得设置断点"exit sub"
使用ACCESS数据库的日期列比较,应为:
"select * from 表 where 日期列=" "#" cdate(textbox1.text) "#"
注意前后两个“#”号
使用sqlserver
"select * from 表 where 日期列=" "'" cdate(textbox1.text) "'"
当然日期格式要注意,如长短日期等。
日期期间:between 小日期 and 大日期(记得加#号)
Q5: vb.net如何调用窗体之间的控件
Public Class ks
Inherits System.Windows.Forms.Form
#Region " Windows 窗体设计器生成的代码 "
Public Sub New()
MyBase.New()
'该调用是 Windows 窗体设计器所必需的。
InitializeComponent()
'在 InitializeComponent() 调用之后添加任何初始化
End Sub
'窗体重写 dispose 以清理组件列表。
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Windows 窗体设计器所必需的
Private components As System.ComponentModel.IContainer
'注意: 以下过程是 Windows 窗体设计器所必需的
'可以使用 Windows 窗体设计器修改此过程。
'不要使用代码编辑器修改它。
Friend WithEvents tx As System.Windows.Forms.TextBox
Friend WithEvents ty As System.Windows.Forms.TextBox
Friend WithEvents tz As System.Windows.Forms.TextBox
Friend WithEvents ok As System.Windows.Forms.Button
Friend WithEvents l1 As System.Windows.Forms.Label
Friend WithEvents l2 As System.Windows.Forms.Label
Friend WithEvents l3 As System.Windows.Forms.Label
System.Diagnostics.DebuggerStepThrough() Private Sub InitializeComponent()
Me.l1 = New System.Windows.Forms.Label
Me.l2 = New System.Windows.Forms.Label
Me.l3 = New System.Windows.Forms.Label
Me.tx = New System.Windows.Forms.TextBox
Me.ty = New System.Windows.Forms.TextBox
Me.tz = New System.Windows.Forms.TextBox
Me.ok = New System.Windows.Forms.Button
Me.SuspendLayout()
'
'l1
'
Me.l1.BackColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(192, Byte), CType(255, Byte))
Me.l1.Location = New System.Drawing.Point(8, 8)
Me.l1.Name = "l1"
Me.l1.Size = New System.Drawing.Size(200, 16)
Me.l1.TabIndex = 0
'
'l2
'
Me.l2.BackColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(192, Byte), CType(255, Byte))
Me.l2.Location = New System.Drawing.Point(8, 32)
Me.l2.Name = "l2"
Me.l2.Size = New System.Drawing.Size(200, 16)
Me.l2.TabIndex = 1
'
'l3
'
Me.l3.BackColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(192, Byte), CType(255, Byte))
Me.l3.Location = New System.Drawing.Point(8, 56)
Me.l3.Name = "l3"
Me.l3.Size = New System.Drawing.Size(200, 16)
Me.l3.TabIndex = 2
'
'tx
'
Me.tx.Location = New System.Drawing.Point(8, 80)
Me.tx.Name = "tx"
Me.tx.Size = New System.Drawing.Size(200, 25)
Me.tx.TabIndex = 3
Me.tx.Text = "请输入x"
'
'ty
'
Me.ty.Location = New System.Drawing.Point(8, 104)
Me.ty.Name = "ty"
Me.ty.Size = New System.Drawing.Size(200, 25)
Me.ty.TabIndex = 4
Me.ty.Text = "请输入y"
'
'tz
'
Me.tz.Location = New System.Drawing.Point(8, 128)
Me.tz.Name = "tz"
Me.tz.Size = New System.Drawing.Size(200, 25)
Me.tz.TabIndex = 5
Me.tz.Text = "请输入z"
'
'ok
'
Me.ok.BackColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(192, Byte), CType(255, Byte))
Me.ok.Location = New System.Drawing.Point(8, 160)
Me.ok.Name = "ok"
Me.ok.Size = New System.Drawing.Size(200, 64)
Me.ok.TabIndex = 6
Me.ok.Text = "ok"
'
'ks
'
Me.AutoScaleBaseSize = New System.Drawing.Size(8, 18)
Me.BackColor = System.Drawing.Color.FromArgb(CType(128, Byte), CType(128, Byte), CType(255, Byte))
Me.ClientSize = New System.Drawing.Size(216, 232)
Me.Controls.Add(Me.ok)
Me.Controls.Add(Me.tz)
Me.Controls.Add(Me.ty)
Me.Controls.Add(Me.tx)
Me.Controls.Add(Me.l3)
Me.Controls.Add(Me.l2)
Me.Controls.Add(Me.l1)
Me.Name = "ks"
Me.Text = "考试"
Me.ResumeLayout(False)
End Sub
#End Region
Dim x, y, z, a, b, c, d, aa, bb, cc As Single
Dim tts, alls As Single
Private Sub ks_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
x = Int(1 + 30 * Rnd())
y = Int(1 + 20 * Rnd())
z = Int(1 + 25 * Rnd())
a = Int(2 + 4 * Rnd())
b = Int(1 + a * 2 * Rnd())
c = Int(1 + b * 2 * Rnd())
d = Int(1 + c * 3 * Rnd())
aa = x + y + z
bb = a * x + b * y + c * z
cc = b * x + c * y + d * z
l1.Text = "x+y+z=" Str(aa)
l2.Text = Str(a) "x+" Str(b) "y+" Str(c) "z=" Str(bb)
l3.Text = Str(b) "x+" Str(c) "y+" Str(d) "z=" Str(cc)
End Sub
Private Sub ok_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ok.Click
If Val(tx.Text) = x And Val(ty.Text) = y And Val(tz.Text) = z Then
tts = tts + 1
End If
alls = alls + 1
tx.Text = ""
ty.Text = ""
tz.Text = ""
x = Int(1 + (1000 ^ 0.5) * Rnd())
y = Int(1 + (10000 ^ 0.4) * Rnd())
z = Int(1 + (100000 ^ 0.3) * Rnd())
a = Int(2 + 4 * Rnd())
b = Int(1 + a * 2 * Rnd())
c = Int(1 + b * 2 * Rnd())
d = Int(1 + c * 3 * Rnd())
aa = x + y + z
bb = a * x + b * y + c * z
cc = b * x + c * y + d * z
l1.Text = "x+y+z=" Str(aa)
l2.Text = Str(a) "x+" Str(b) "y+" Str(c) "z=" Str(bb)
l3.Text = Str(b) "x+" Str(c) "y+" Str(d) "z=" Str(cc)
End Sub
Private Sub ks_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Click
Dim lv As Single
If Not (alls = 0) Then
lv = Int(tts * 100000 / alls) / 1000
MsgBox(Str(lv) "%", , "正确率")
tx.Visible = False
ty.Visible = False
tz.Visible = False
ok.Visible = False
l1.Visible = False
l2.Visible = False
l3.Visible = False
Else
MsgBox("答题!", , "答题!")
End If
End Sub
End Class
关于vb.netcc和的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。







