| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 667 人关注过本帖
标题:你能解釋就你牛
只看楼主 加入收藏
adair
Rank: 3Rank: 3
等 级:新手上路
威 望:9
帖 子:250
专家分:0
注 册:2005-9-3
收藏
 问题点数:0 回复次数:0 
你能解釋就你牛

當你在textbox2的text屬性中任意設置一非空字符.下面會出錯.數組明明存在,出錯說不存在. 當你清空textbox2的text屬性.程序不會出錯. 你能解釋嗎????? 你能解釋你最牛 你可以把下面的代碼全部復製過去 Imports System.IO Imports VB = Microsoft.VisualBasic Imports System.Data.OleDb

Public Class Startform Inherits System.Windows.Forms.Form #Region "Windows Form Designer generated code " Public Sub New() MyBase.New() 'This call is required by the Windows Form Designer. InitializeComponent() End Sub 'Form overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal Disposing As Boolean) If Disposing Then Static fTerminateCalled As Boolean If Not fTerminateCalled Then ' Form_Terminate_Renamed() fTerminateCalled = True End If If Not components Is Nothing Then components.Dispose() End If End If MyBase.Dispose(Disposing) End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer

Public WithEvents _Text1_6 As System.Windows.Forms.TextBox Public WithEvents _Text1_0 As System.Windows.Forms.TextBox Public WithEvents _Text1_5 As System.Windows.Forms.TextBox Public WithEvents _Text1_4 As System.Windows.Forms.TextBox Public WithEvents _Text1_3 As System.Windows.Forms.TextBox Public WithEvents _Text1_2 As System.Windows.Forms.TextBox Public WithEvents _Text1_1 As System.Windows.Forms.TextBox Public WithEvents Frame2 As System.Windows.Forms.GroupBox Public WithEvents Frame1 As System.Windows.Forms.GroupBox

'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor.

Friend WithEvents Timer1 As System.Windows.Forms.Timer Friend WithEvents TextBox22 As System.Windows.Forms.TextBox Friend WithEvents TextBoxArray1 As Microsoft.VisualBasic.Compatibility.VB6.TextBoxArray Friend WithEvents TextBox2 As System.Windows.Forms.TextBox <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() Me.components = New System.ComponentModel.Container Me.TextBox2 = New System.Windows.Forms.TextBox Me.Frame1 = New System.Windows.Forms.GroupBox Me.Frame2 = New System.Windows.Forms.GroupBox Me.TextBox22 = New System.Windows.Forms.TextBox Me._Text1_6 = New System.Windows.Forms.TextBox Me._Text1_5 = New System.Windows.Forms.TextBox Me._Text1_4 = New System.Windows.Forms.TextBox Me._Text1_3 = New System.Windows.Forms.TextBox Me._Text1_2 = New System.Windows.Forms.TextBox Me._Text1_1 = New System.Windows.Forms.TextBox Me._Text1_0 = New System.Windows.Forms.TextBox Me.Timer1 = New System.Windows.Forms.Timer(Me.components) Me.TextBoxArray1 = New Microsoft.VisualBasic.Compatibility.VB6.TextBoxArray(Me.components) Me.Frame1.SuspendLayout() Me.Frame2.SuspendLayout() CType(Me.TextBoxArray1, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' 'TextBox2 ' Me.TextBox2.Location = New System.Drawing.Point(136, 376) Me.TextBox2.Name = "TextBox2" Me.TextBox2.Size = New System.Drawing.Size(336, 20) Me.TextBox2.TabIndex = 26 Me.TextBox2.Text = "0" ' 'Frame1 ' Me.Frame1.BackColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(192, Byte), CType(255, Byte)) Me.Frame1.Controls.Add(Me.Frame2) Me.Frame1.Font = New System.Drawing.Font("Arial", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.Frame1.ForeColor = System.Drawing.SystemColors.ControlText Me.Frame1.Location = New System.Drawing.Point(600, 24) Me.Frame1.Name = "Frame1" Me.Frame1.RightToLeft = System.Windows.Forms.RightToLeft.No Me.Frame1.Size = New System.Drawing.Size(313, 344) Me.Frame1.TabIndex = 3 Me.Frame1.TabStop = False ' 'Frame2 ' Me.Frame2.BackColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(192, Byte), CType(255, Byte)) Me.Frame2.Controls.Add(Me.TextBox22) Me.Frame2.Controls.Add(Me._Text1_6) Me.Frame2.Controls.Add(Me._Text1_5) Me.Frame2.Controls.Add(Me._Text1_4) Me.Frame2.Controls.Add(Me._Text1_3) Me.Frame2.Controls.Add(Me._Text1_2) Me.Frame2.Controls.Add(Me._Text1_1) Me.Frame2.Controls.Add(Me._Text1_0) Me.Frame2.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.Frame2.ForeColor = System.Drawing.SystemColors.ControlText Me.Frame2.Location = New System.Drawing.Point(8, 16) Me.Frame2.Name = "Frame2" Me.Frame2.RightToLeft = System.Windows.Forms.RightToLeft.No Me.Frame2.Size = New System.Drawing.Size(297, 232) Me.Frame2.TabIndex = 4 Me.Frame2.TabStop = False Me.Frame2.Text = "0" ' 'TextBox22 ' Me.TextBox22.Location = New System.Drawing.Point(192, 50) Me.TextBox22.Name = "TextBox22" Me.TextBox22.Size = New System.Drawing.Size(65, 20) Me.TextBox22.TabIndex = 60 Me.TextBox22.Text = "" ' '_Text1_6 ' Me._Text1_6.AcceptsReturn = True Me._Text1_6.AutoSize = False Me._Text1_6.BackColor = System.Drawing.SystemColors.ActiveCaptionText Me._Text1_6.Cursor = System.Windows.Forms.Cursors.IBeam Me._Text1_6.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me._Text1_6.ForeColor = System.Drawing.SystemColors.WindowText Me.TextBoxArray1.SetIndex(Me._Text1_6, CType(6, Short)) Me._Text1_6.Location = New System.Drawing.Point(192, 16) Me._Text1_6.MaxLength = 0 Me._Text1_6.Name = "_Text1_6" Me._Text1_6.ReadOnly = True Me._Text1_6.RightToLeft = System.Windows.Forms.RightToLeft.No Me._Text1_6.Size = New System.Drawing.Size(65, 20) Me._Text1_6.TabIndex = 56 Me._Text1_6.Text = "0" ' '_Text1_5 ' Me._Text1_5.AcceptsReturn = True Me._Text1_5.AutoSize = False Me._Text1_5.BackColor = System.Drawing.SystemColors.Window Me._Text1_5.Cursor = System.Windows.Forms.Cursors.IBeam Me._Text1_5.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me._Text1_5.ForeColor = System.Drawing.SystemColors.WindowText Me.TextBoxArray1.SetIndex(Me._Text1_5, CType(5, Short)) Me._Text1_5.Location = New System.Drawing.Point(192, 208) Me._Text1_5.MaxLength = 0 Me._Text1_5.Name = "_Text1_5" Me._Text1_5.ReadOnly = True Me._Text1_5.RightToLeft = System.Windows.Forms.RightToLeft.No Me._Text1_5.Size = New System.Drawing.Size(65, 20) Me._Text1_5.TabIndex = 54 Me._Text1_5.Text = "0" ' '_Text1_4 ' Me._Text1_4.AcceptsReturn = True Me._Text1_4.AutoSize = False Me._Text1_4.BackColor = System.Drawing.SystemColors.Window Me._Text1_4.Cursor = System.Windows.Forms.Cursors.IBeam Me._Text1_4.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me._Text1_4.ForeColor = System.Drawing.SystemColors.WindowText Me.TextBoxArray1.SetIndex(Me._Text1_4, CType(4, Short)) Me._Text1_4.Location = New System.Drawing.Point(192, 176) Me._Text1_4.MaxLength = 0 Me._Text1_4.Name = "_Text1_4" Me._Text1_4.ReadOnly = True Me._Text1_4.RightToLeft = System.Windows.Forms.RightToLeft.No Me._Text1_4.Size = New System.Drawing.Size(65, 20) Me._Text1_4.TabIndex = 18 Me._Text1_4.Text = "0" ' '_Text1_3 ' Me._Text1_3.AcceptsReturn = True Me._Text1_3.AutoSize = False Me._Text1_3.BackColor = System.Drawing.SystemColors.Window Me._Text1_3.Cursor = System.Windows.Forms.Cursors.IBeam Me._Text1_3.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me._Text1_3.ForeColor = System.Drawing.SystemColors.WindowText Me.TextBoxArray1.SetIndex(Me._Text1_3, CType(3, Short)) Me._Text1_3.Location = New System.Drawing.Point(192, 144) Me._Text1_3.MaxLength = 0 Me._Text1_3.Name = "_Text1_3" Me._Text1_3.ReadOnly = True Me._Text1_3.RightToLeft = System.Windows.Forms.RightToLeft.No Me._Text1_3.Size = New System.Drawing.Size(65, 20) Me._Text1_3.TabIndex = 17 Me._Text1_3.Text = "0" ' '_Text1_2 ' Me._Text1_2.AcceptsReturn = True Me._Text1_2.AutoSize = False Me._Text1_2.BackColor = System.Drawing.SystemColors.Window Me._Text1_2.Cursor = System.Windows.Forms.Cursors.IBeam Me._Text1_2.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me._Text1_2.ForeColor = System.Drawing.SystemColors.WindowText Me.TextBoxArray1.SetIndex(Me._Text1_2, CType(2, Short)) Me._Text1_2.Location = New System.Drawing.Point(192, 112) Me._Text1_2.MaxLength = 0 Me._Text1_2.Name = "_Text1_2" Me._Text1_2.ReadOnly = True Me._Text1_2.RightToLeft = System.Windows.Forms.RightToLeft.No Me._Text1_2.Size = New System.Drawing.Size(65, 20) Me._Text1_2.TabIndex = 16 Me._Text1_2.Text = "0" ' '_Text1_1 ' Me._Text1_1.AcceptsReturn = True Me._Text1_1.AutoSize = False Me._Text1_1.BackColor = System.Drawing.SystemColors.Window Me._Text1_1.Cursor = System.Windows.Forms.Cursors.IBeam Me._Text1_1.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me._Text1_1.ForeColor = System.Drawing.SystemColors.WindowText Me.TextBoxArray1.SetIndex(Me._Text1_1, CType(1, Short)) Me._Text1_1.Location = New System.Drawing.Point(192, 80) Me._Text1_1.MaxLength = 0 Me._Text1_1.Name = "_Text1_1" Me._Text1_1.ReadOnly = True Me._Text1_1.RightToLeft = System.Windows.Forms.RightToLeft.No Me._Text1_1.Size = New System.Drawing.Size(65, 20) Me._Text1_1.TabIndex = 15 Me._Text1_1.Text = "0" ' '_Text1_0 ' Me._Text1_0.AcceptsReturn = True Me._Text1_0.AutoSize = False Me._Text1_0.BackColor = System.Drawing.SystemColors.ActiveCaptionText Me._Text1_0.Cursor = System.Windows.Forms.Cursors.IBeam Me._Text1_0.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me._Text1_0.ForeColor = System.Drawing.SystemColors.WindowText Me.TextBoxArray1.SetIndex(Me._Text1_0, CType(0, Short)) Me._Text1_0.Location = New System.Drawing.Point(40, 48) Me._Text1_0.MaxLength = 0 Me._Text1_0.Name = "_Text1_0" Me._Text1_0.ReadOnly = True Me._Text1_0.RightToLeft = System.Windows.Forms.RightToLeft.No Me._Text1_0.Size = New System.Drawing.Size(65, 20) Me._Text1_0.TabIndex = 55 Me._Text1_0.Text = "0" Me._Text1_0.Visible = False ' 'Timer1 ' Me.Timer1.Enabled = True ' 'Startform ' Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.BackColor = System.Drawing.SystemColors.Control Me.ClientSize = New System.Drawing.Size(1016, 722) Me.Controls.Add(Me.TextBox2) Me.Controls.Add(Me.Frame1) Me.Cursor = System.Windows.Forms.Cursors.Default Me.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.Location = New System.Drawing.Point(11, 57) Me.Name = "Startform" Me.RightToLeft = System.Windows.Forms.RightToLeft.No Me.WindowState = System.Windows.Forms.FormWindowState.Maximized Me.Frame1.ResumeLayout(False) Me.Frame2.ResumeLayout(False) CType(Me.TextBoxArray1, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False)

End Sub #End Region

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Me.textbox2.Text = Now

' TextBox1.Text = Now End Sub

Private Sub textbox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged Me.TextBoxArray1(0).Text = 0 & Now Me.TextBoxArray1(1).Text = 1 & Now Me.TextBoxArray1(2).Text = 2 & Now Me.TextBoxArray1(3).Text = 3 & Now Me.TextBoxArray1(4).Text = 4 & Now End Sub

Private Sub Startform_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub End Class

搜索更多相关主题的帖子: 解釋 
2005-09-23 21:05
快速回复:你能解釋就你牛
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.028459 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved