-
vn的可变数据类型_在VB中可变类型变量的使用
2021-01-14 10:26:32在VB中可变类型变量的使用摘要:在VB中变量的数据类型有很多种类,如字符型串型、数值型、日期型、布尔型等。还有一种特殊类型:可变类型(Variant)。定义了一个可变类型变量后,该变量可以存放任何类型的数据(数值...在VB中可变类型变量的使用
摘要:在
VB
中变量的数据类型有很多种类,如字符
型串型、数值型、日期型、布尔型等。还有一种特殊类型:
可变类型
(
Variant
)
。
定义了一个可变类型变量后,
该变量可
以存放任何类型的数据(数值、字符、日期等)
,这样在给
变量赋值时就不用对数据进行转换了,
VB
系统会根据赋给
变量的值的不同自动进行数据类型的转换。
关键词:变量;数据类型;可变类型;程序设计
中图分类号:
TP311
文献标识码:
A
文章编号:
1009-3044(2008)26-1720-02
Variant Variables Use In Visual Basic
WANG Jin-feng
(Wuhan Engineering Institute, Wuhan 430415, China)
Abstact: Variables data type in Visual Basic is of many
types such as string,numeric,date,boolen etc. And among them is
Variant, a special type. A variables which is defined by the
variant can be stored with any type of data (numeric,string, date
and so on).Therefore,it is not necessary for usto make any
conversion between data types, because Visual Basic can do so
automatically according to the value of defined variables.
Key words: variables; data type; variant; programming
-
关于c#webform 通用变量的几种办法
2015-11-12 10:26:55一、C#中的全局变量 C#中没有了像VB.Net中的全局变量,那么我们如何实现在...3.在该窗体中定义静态型字符串变量myTestStr1: public static string myTestStr1=""; 4.在该窗体的构造函数中对该变量进行赋值,一、C#中的全局变量
C#中没有了像VB.Net中的全局变量,那么我们如何实现在不同的页面间传递参数呢?
下面举例说明如何实现这一功能.
1.新建一个项目.
2.在该工程中添加一个窗体Form1.
3.在该窗体中定义静态型字符串变量myTestStr1:
public static string myTestStr1="";
4.在该窗体的构造函数中对该变量进行赋值,并为该窗体类添加属性GetStrValue.
public Form_Form1()
{
InitializeComponent();
myTestStr1="Hello!";
}
public string GetStrValue
{
get
{
return myTestStr1;
}
set
{
myTestStr1=value;
}
}
5.在该工程中另添加一个窗体Form2.
6.在Form1窗体上添加一个button按钮(name:but_Test);
7.在Form1窗体的but_Test_Click 事件中添加以下代码:
private void but_Test_Click(object sender, System.EventArgs e)
{
Form2 frm1=new Form2();
frm1.ShowDialog(this) ;
frm1.Close();
}
8.在Form2窗体上添加一个button按钮(name:but_Yes);
9.在Form1窗体的but_Yes_Click 事件中添加以下代码:
private void but_Yes_Click(object sender, System.EventArgs e)
{
MessageBox.Show (Form_Form1.myTestStr1 ); //直接访问. 显示.结果:" Hello!"
Form_Form1 frm2=new Form_Form1();
frm2.GetStrValue ="How do you do?"; //生成一个新的实例对该静态变量进行操作(修改该静态变量的值).
MessageBox.Show (frm2.GetStrValue ); //通过该实例的内部成员对它进行访问 .显示.结果: How do you do?"
MessageBox.Show (Form_Form1.myTestStr1 ); //直接访问. 显示.结果:" How do you do?"
}
二、在Windows窗体开发中使用Cache
Cache在程序设计时可以带来很大的便利,这点想必在web程序开发中大家都有深刻的体会!同样,在windows程序设计中也可以使用它。
使用时需要将web引用添加到窗体项目的引用中,下面以一个实例介绍之!
首先要将程序的Main()函数放在一个添加的类里,这里就是AppMain类。下面是AppMain类的代码:
using System;
using System.Threading;
using System.Web;//添加引用
using System.Web.Caching; //添加引用
using System.Windows.Forms;
namespace WindowsApplication1
{
public class AppMain
{
private static HttpRuntime _httpRuntime;
public static Cache Cache
{
get
{
EnsureHttpRuntime();
return HttpRuntime.Cache;
}
}
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private static void EnsureHttpRuntime()
{
if( null == _httpRuntime )
{
try
{
Monitor.Enter( typeof( AppMain ) );
if( null == _httpRuntime )
{
// Create an Http Content to give us access to the cache.
_httpRuntime = new HttpRuntime();
}
}
finally
{
Monitor.Exit( typeof( AppMain ) );
}
}
}
}
}
然后在Form1窗体中定义和使用Cache,代码如下:
using System;
using System.Web;//添加引用
using System.Web.Caching; //添加引用
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace WindowsApplication1
{
///<summary>
/// Form1 的摘要说明。
///</summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox txtValueToPutInCache;
private System.Windows.Forms.TextBox txtValueInCache;
private System.Windows.Forms.Button btnPutInCache;
private System.Windows.Forms.Button btnGetFromButton;
private const string CACHE_KEY = "APPCACHEKEY";
///<summary>
/// Required designer variable.
///</summary>
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
///<summary>
/// Clean up any resources being used.
///</summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
///<summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///</summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.txtValueToPutInCache = new System.Windows.Forms.TextBox();
this.txtValueInCache = new System.Windows.Forms.TextBox();
this.btnPutInCache = new System.Windows.Forms.Button();
this.btnGetFromButton = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(8, 16);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(113, 16);
this.label1.TabIndex = 0;
this.label1.Text = "Value to put in cache:";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(8, 40);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(95, 16);
this.label2.TabIndex = 1;
this.label2.Text = "Value from cache:";
//
// txtValueToPutInCache
//
this.txtValueToPutInCache.Location = new System.Drawing.Point(128, 16);
this.txtValueToPutInCache.Name = "txtValueToPutInCache";
this.txtValueToPutInCache.Size = new System.Drawing.Size(200, 20);
this.txtValueToPutInCache.TabIndex = 2;
this.txtValueToPutInCache.Text = "";
//
// txtValueInCache
//
this.txtValueInCache.Location = new System.Drawing.Point(128, 40);
this.txtValueInCache.Name = "txtValueInCache";
this.txtValueInCache.ReadOnly = true;
this.txtValueInCache.Size = new System.Drawing.Size(200, 20);
this.txtValueInCache.TabIndex = 3;
this.txtValueInCache.Text = "";
//
// btnPutInCache
//
this.btnPutInCache.Location = new System.Drawing.Point(352, 16);
this.btnPutInCache.Name = "btnPutInCache";
this.btnPutInCache.Size = new System.Drawing.Size(104, 23);
this.btnPutInCache.TabIndex = 4;
this.btnPutInCache.Text = "Put in Cache";
this.btnPutInCache.Click +=
new System.EventHandler(this.btnPutInCache_Click);
//
// btnGetFromButton
//
this.btnGetFromButton.Location = new System.Drawing.Point(352, 40);
this.btnGetFromButton.Name = "btnGetFromButton";
this.btnGetFromButton.Size = new System.Drawing.Size(104, 23);
this.btnGetFromButton.TabIndex = 5;
this.btnGetFromButton.Text = "Get from Cache";
this.btnGetFromButton.Click +=
new System.EventHandler(this.btnGetFromButton_Click);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(488, 133);
this.Controls.Add(this.btnGetFromButton);
this.Controls.Add(this.btnPutInCache);
this.Controls.Add(this.txtValueInCache);
this.Controls.Add(this.txtValueToPutInCache);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
}
#endregion
private void btnPutInCache_Click(object sender, System.EventArgs e)
{
AppMain.Cache.Insert(
CACHE_KEY,
txtValueToPutInCache.Text,
null,
Cache.NoAbsoluteExpiration,
TimeSpan.FromSeconds( 60 ) );
}
private void btnGetFromButton_Click(object sender, System.EventArgs e)
{
string value;
value = AppMain.Cache[ CACHE_KEY ] as string;
if( null == value )
{
value = "[No value in the cache.]";
}
txtValueInCache.Text = value;
}
}
}
三、windows form参数传递过程
在Windows 程序设计中参数的传递,同样也是非常的重要的。
这里主要是通过带有参数的构造函数来实现的,
说明:Form1为主窗体,包含控件:文本框textBoxFrm1,多选框checkBoxFrm1和按钮buttonEdit;
Form2为子窗体,包含控件:文本框textBoxFrm2,多选框checkBoxFrm2和按钮buttonOK,buttonCancel。
当我们新建一个窗体的时候,设计器会生成默认的构造函数:
public Form2()
{
InitializeComponent();
}
它不带参数,既然我们要把Form1中的一些数据传到Form2中去,为什么不在Form2的构造函数里做文章呢?
假设我们要实现使Form2中的文本框显示Form1里textBoxFrm1的值,修改子窗体的构造函数:
public Form2(string text)
{
InitializeComponent();
this.textBoxFrm2.Text = text;
} 增加Form1中的修改按钮点击事件,处理函数如下:
private void buttonEdit_Click(object sender, System.EventArgs e)
{
Form2 formChild = new Form2(this.textBoxFrm1.Text);
formChild.Show();
}
我们把this.textBoxFrm1.Text作为参数传到子窗体构造函数,以非模式方式打开,这样打开的formChild的文本框就显示了”主窗体”文本,是不是很简单,接下来我们传一个boolean数据给子窗体。
Public Form2(string text,bool checkedValue)
{
InitializeComponent();
this.textBoxFrm2.Text = text;
this.checkBoxFrm2.Checked = checkedValue;
}
private void buttonEdit_Click(object sender, System.EventArgs e)
{
Form2 formChild = new Form2(this.textBoxFrm1.Text,this.checkBoxFrm1.Checked);
formChild.Show();
} -
C#中的全局变量 winform全局变量,传参,cache,datagrid简单介绍
2007-12-06 11:21:04一、C#中的全局变量 C#中没有了像VB.Net中的全局变量,...3.在该窗体中定义静态型字符串变量myTestStr1: public static string myTestStr1=""; 4.在该窗体的构造函数中对该变量进行赋值,并为该窗体...一、C#中的全局变量
C#中没有了像VB.Net中的全局变量,那么我们如何实现在不同的页面间传递参数呢?
下面举例说明如何实现这一功能.
1.新建一个项目.
2.在该工程中添加一个窗体Form1.
3.在该窗体中定义静态型字符串变量myTestStr1:
public static string myTestStr1="";
4.在该窗体的构造函数中对该变量进行赋值,并为该窗体类添加属性GetStrValue.
public Form_Form1()
{
InitializeComponent();
myTestStr1="Hello!";
}
public string GetStrValue
{
get
{
return myTestStr1;
}
set
{
myTestStr1=value;
}
}
5.在该工程中另添加一个窗体Form2.
6.在Form1窗体上添加一个button按钮(name:but_Test);
7.在Form1窗体的but_Test_Click 事件中添加以下代码:
private void but_Test_Click(object sender, System.EventArgs e)
{
Form2 frm1=new Form2();
frm1.ShowDialog(this) ;
frm1.Close();
}
8.在Form2窗体上添加一个button按钮(name:but_Yes);
9.在Form1窗体的but_Yes_Click 事件中添加以下代码:
private void but_Yes_Click(object sender, System.EventArgs e)
{
MessageBox.Show (Form_Form1.myTestStr1 ); //直接访问. 显示.结果:" Hello!"
Form_Form1 frm2=new Form_Form1();
frm2.GetStrValue ="How do you do?"; //生成一个新的实例对该静态变量进行操作(修改该静态变量的值).
MessageBox.Show (frm2.GetStrValue ); //通过该实例的内部成员对它进行访问 .显示.结果: How do you do?"
MessageBox.Show (Form_Form1.myTestStr1 ); //直接访问. 显示.结果:" How do you do?"
}
二、在Windows窗体开发中使用Cache
Cache在程序设计时可以带来很大的便利,这点想必在web程序开发中大家都有深刻的体会!同样,在windows程序设计中也可以使用它。
使用时需要将web引用添加到窗体项目的引用中,下面以一个实例介绍之!
首先要将程序的Main()函数放在一个添加的类里,这里就是AppMain类。下面是AppMain类的代码:
using System;
using System.Threading;
using System.Web;//添加引用
using System.Web.Caching; //添加引用
using System.Windows.Forms;
namespace WindowsApplication1
{
public class AppMain
{
private static HttpRuntime _httpRuntime;
public static Cache Cache
{
get
{
EnsureHttpRuntime();
return HttpRuntime.Cache;
}
}
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private static void EnsureHttpRuntime()
{
if( null == _httpRuntime )
{
try
{
Monitor.Enter( typeof( AppMain ) );
if( null == _httpRuntime )
{
// Create an Http Content to give us access to the cache.
_httpRuntime = new HttpRuntime();
}
}
finally
{
Monitor.Exit( typeof( AppMain ) );
}
}
}
}
}
然后在Form1窗体中定义和使用Cache,代码如下:
using System;
using System.Web;//添加引用
using System.Web.Caching; //添加引用
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace WindowsApplication1
{
///<summary>
/// Form1 的摘要说明。
///</summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox txtValueToPutInCache;
private System.Windows.Forms.TextBox txtValueInCache;
private System.Windows.Forms.Button btnPutInCache;
private System.Windows.Forms.Button btnGetFromButton;
private const string CACHE_KEY = "APPCACHEKEY";
///<summary>
/// Required designer variable.
///</summary>
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
///<summary>
/// Clean up any resources being used.
///</summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
///<summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///</summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.txtValueToPutInCache = new System.Windows.Forms.TextBox();
this.txtValueInCache = new System.Windows.Forms.TextBox();
this.btnPutInCache = new System.Windows.Forms.Button();
this.btnGetFromButton = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(8, 16);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(113, 16);
this.label1.TabIndex = 0;
this.label1.Text = "Value to put in cache:";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(8, 40);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(95, 16);
this.label2.TabIndex = 1;
this.label2.Text = "Value from cache:";
//
// txtValueToPutInCache
//
this.txtValueToPutInCache.Location = new System.Drawing.Point(128, 16);
this.txtValueToPutInCache.Name = "txtValueToPutInCache";
this.txtValueToPutInCache.Size = new System.Drawing.Size(200, 20);
this.txtValueToPutInCache.TabIndex = 2;
this.txtValueToPutInCache.Text = "";
//
// txtValueInCache
//
this.txtValueInCache.Location = new System.Drawing.Point(128, 40);
this.txtValueInCache.Name = "txtValueInCache";
this.txtValueInCache.ReadOnly = true;
this.txtValueInCache.Size = new System.Drawing.Size(200, 20);
this.txtValueInCache.TabIndex = 3;
this.txtValueInCache.Text = "";
//
// btnPutInCache
//
this.btnPutInCache.Location = new System.Drawing.Point(352, 16);
this.btnPutInCache.Name = "btnPutInCache";
this.btnPutInCache.Size = new System.Drawing.Size(104, 23);
this.btnPutInCache.TabIndex = 4;
this.btnPutInCache.Text = "Put in Cache";
this.btnPutInCache.Click +=
new System.EventHandler(this.btnPutInCache_Click);
//
// btnGetFromButton
//
this.btnGetFromButton.Location = new System.Drawing.Point(352, 40);
this.btnGetFromButton.Name = "btnGetFromButton";
this.btnGetFromButton.Size = new System.Drawing.Size(104, 23);
this.btnGetFromButton.TabIndex = 5;
this.btnGetFromButton.Text = "Get from Cache";
this.btnGetFromButton.Click +=
new System.EventHandler(this.btnGetFromButton_Click);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(488, 133);
this.Controls.Add(this.btnGetFromButton);
this.Controls.Add(this.btnPutInCache);
this.Controls.Add(this.txtValueInCache);
this.Controls.Add(this.txtValueToPutInCache);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
}
#endregion
private void btnPutInCache_Click(object sender, System.EventArgs e)
{
AppMain.Cache.Insert(
CACHE_KEY,
txtValueToPutInCache.Text,
null,
Cache.NoAbsoluteExpiration,
TimeSpan.FromSeconds( 60 ) );
}
private void btnGetFromButton_Click(object sender, System.EventArgs e)
{
string value;
value = AppMain.Cache[ CACHE_KEY ] as string;
if( null == value )
{
value = "[No value in the cache.]";
}
txtValueInCache.Text = value;
}
}
}
三、windows form参数传递过程
在Windows 程序设计中参数的传递,同样也是非常的重要的。
这里主要是通过带有参数的构造函数来实现的,
说明:Form1为主窗体,包含控件:文本框textBoxFrm1,多选框checkBoxFrm1和按钮buttonEdit;
Form2为子窗体,包含控件:文本框textBoxFrm2,多选框checkBoxFrm2和按钮buttonOK,buttonCancel。
当我们新建一个窗体的时候,设计器会生成默认的构造函数:
public Form2()
{
InitializeComponent();
}
它不带参数,既然我们要把Form1中的一些数据传到Form2中去,为什么不在Form2的构造函数里做文章呢?
假设我们要实现使Form2中的文本框显示Form1里textBoxFrm1的值,修改子窗体的构造函数:
public Form2(string text)
{
InitializeComponent();
this.textBoxFrm2.Text = text;
} 增加Form1中的修改按钮点击事件,处理函数如下:
private void buttonEdit_Click(object sender, System.EventArgs e)
{
Form2 formChild = new Form2(this.textBoxFrm1.Text);
formChild.Show();
}
我们把this.textBoxFrm1.Text作为参数传到子窗体构造函数,以非模式方式打开,这样打开的formChild的文本框就显示了”主窗体”文本,是不是很简单,接下来我们传一个boolean数据给子窗体。
Public Form2(string text,bool checkedValue)
{
InitializeComponent();
this.textBoxFrm2.Text = text;
this.checkBoxFrm2.Checked = checkedValue;
}
private void buttonEdit_Click(object sender, System.EventArgs e)
{
Form2 formChild = new Form2(this.textBoxFrm1.Text,this.checkBoxFrm1.Checked);
formChild.Show();
} -
VB程序设计典型算法(重点难点).doc
2020-06-22 12:55:25Visual Basic 的基本控制结构 顺序结构各语句依次顺序执行 此前所学的语句的存在...字符型数据"0129"赋值给数值型变量时系统先自 动将字符串转换为数值再赋值但是字符不可以 非字符数据赋值给字符变量时将被转换为字 -
C#中的"全局变量
2005-07-14 14:32:00C#中没有了像VB.Net中的全局变量,那么我们如何实现在不同...在该窗体中定义静态型字符串变量myTestStr1: public static string myTestStr1="";4.在该窗体的构造函数中对该变量进行赋值,并为该窗体类添加属性GetStrVaC#中没有了像VB.Net中的全局变量,那么我们如何实现在不同的页面间传递参数呢?
下面举例说明如何实现这一功能.
1.新建一个工程HeroClock.
2.在该工程中添加一个窗体ClockSet.
3.在该窗体中定义静态型字符串变量myTestStr1:
public static string myTestStr1="";
4.在该窗体的构造函数中对该变量进行赋值,并为该窗体类添加属性GetStrValue.public Form_ClockSet()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
myTestStr1="frj nihao";
}
public string GetStrValue
{
get
{
return myTestStr1;
}
set
{
myTestStr1=value;
}}
5.在该工程中另添加一个窗体TimeSet.
6.在ClockSet窗体上添加一个button按钮(name:but_Test);
7.在ClockSet窗体的but_Test_Click 事件中添加以下代码:
private void but_Test_Click(object sender, System.EventArgs e)
{
TimeSet frm1=new TimeSet();
frm1.ShowDialog(this) ;
frm1.Close();
}
8.在TimeSet窗体上添加一个button按钮(name:but_Yes);
9.在ClockSet窗体的but_Yes_Click 事件中添加以下代码:
private void but_Yes_Click(object sender, System.EventArgs e)
{
MessageBox.Show (Form_ClockSet.myTestStr1 ); //直接访问. 显示.结果:"frj nihao"Form_ClockSet frm2=new Form_ClockSet();
frm2.GetStrValue ="hlk nihao"; //生成一个新的实例对该静态变量进行操作(修改该静态变量的值).
MessageBox.Show (frm2.GetStrValue ); //通过该实例的内部成员对它进行访问 .显示.结果:"hlk nihao"
MessageBox.Show (Form_ClockSet.myTestStr1 ); //直接访问. 显示.结果:"hlk nihao"
} -
vb程序设计程序控制结构和算法基础.ppt
2020-02-29 13:55:41b , n , s , m b = 0 将整型数据赋值给逻辑型变量b为 b = 2 将整型数据赋值给逻辑型变量b为 n = b 将逻辑型数据赋值给整型变量n为-1 s = b 将逻辑型数据赋值给字符串变量s为 m = -1012.567 s = m 将数值数据赋值给... -
C#语言中变量的使用和注意事项
2004-09-07 01:01:00一、变量声明的问题:1、习惯了vb,大小写是一个十分棘手的问题,又不得不这样做。2、声明的时候可以同时赋值,也可以同时声明多个变量,为了写的程序好读,约定声明与赋值分离。3、要想使用一个变量,必须提前声明... -
VB课本总结
2019-02-02 09:08:56数据类型 :数值型、字符串型、逻辑布尔型、日期时间型。 常用内部函数:数学、字符串、转换、日期与时间、随机数、格式输出...赋值语句的功能:首先计算赋值号右边表达式的值,然后将此值赋给赋值号左边的变量或属... -
tdbgrid 数据类型输入错误 vb_VB之顺序结构程序设计
2020-12-05 22:48:451、数据输入两种方法(1)TextBox文本框控件:返回字符型(2) InputBox()输入框函数:可产生一个对话框,作为输入数据的界面,等待用户输入数据,并返回所输入的内容,返回字符型。格式: 变量名=InputBox(提示信息[,标题]... -
winform全局变量,传参,cache,datagrid简单介绍(转贴)
2008-09-24 08:01:00一、C#中的全局变量 C#中没有了像VB.Net中的全局变量,那么我们...3.在该窗体中定义静态型字符串变量myTestStr1: public static string myTestStr1=""; 4.在该窗体的构造函数中对该变量进行赋值,并为该窗体类... -
Javascript简明教程二 变量
2008-09-15 14:49:00上一篇介绍了Js的几种使用方式,下面介绍一下一门语言最基础的部分,就是变量 声明与赋值 首先js类似vb,是一种弱类型的变量 比如 var x=1;...而且变量的类型也是根据最后一次赋值的情况来变换的,也就是... -
公路路线计算程序VB版
2013-12-26 21:27:00'以下部分是将存储在数组变量 m(i)中的字符分类存放到方向、边长、已知坐标、网型信息等数组中 k = k + 1 For j = 1 To 5 jd(k, j) = Val(tr(j)) Next j zjd = k Loop ts.Close MsgBox "转角数据已成功读入", 0 + 64... -
c# winform间传递参数的方法
2012-09-11 10:33:11C#中没有了像VB.Net中的全局变量,那么我们如何实现...3.在该窗体中定义静态型字符串变量myTestStr1: public static string myTestStr1=""; 4.在该窗体的构造函数中对该变量进行赋值,并为该窗体类添加属性GetStrValue. -
坚持学asp.net——(四)
2004-08-30 13:13:00c#编程篇:c#编程我不怎么熟悉,既然教材里面有,就顺着它的思路学一下。开始就讲什么变量、内存拉,看看就可以。一、变量声明的问题:1、习惯了vb,大小写是一个十分棘手的问题,又不得不这样做。...给数字型变量提供 -
2010年 c语言入门到精通
2010-09-07 22:26:33如果按存储占用空间来分,可以是整型变量,字符型变量,浮点型变量等.当然还有数组,结构体变量等. C语言还有一个重要变量:指针变量.它存放的值是一个内存地址. 另一点,声明变量时,可以不用声明就直接赋值来决定... -
高中信息技术算法与程序设计题库(含答案).docx
2020-10-09 01:48:02下列属于字符型常量的是 Aword B北京奥运会 C#2006-11-10# D"1234" 3?函数?Abs(-9)返回的值是 A3 B4 C9 D-9 4?在?VB?语言中下列正确的赋值语句是 Aa?+?4?=?c Ba?=?2?+?c Ca?+?4?=?b?-?5 Da?/?2?=?c?3 5?以下程序段... -
delphi6串口通信
2010-10-13 17:45:27由于Delphi中数组跟Variant变量不兼容,即在Delphi中字节数组不能直接赋值给MSComm控件的output属性,这跟VB有中很大的不同(VB中可以直接赋值),本人通过摸索总结出两种实现Delphi二进制通信的方法,即动态数组法和... -
研华PCI-1761接点检测
2014-09-19 15:13:54'将取到的随机数调用副程序Ten2Two 将十进制接收值转换为0与1的二进制后 赋值给文字型变量aa aa = Format(Trim(CStr(Ten2Two(RndVal))), "00000000") Label1.Caption = CStr(RndVal) '让标签显示接收到(随机数)的... -
-
C#微软培训教材(高清PDF)
2009-07-30 08:51:1718.2 在 C #代码中调用 C++和 VB 编写的组件 .240 18.3 版 本 控 制 .249 18.4 代 码 优 化 .252 18.5 小 结 .254 第五部分 附 录 .255 附录 A 关 键 字.255 附录 B 错 误 码.256 附录 C .Net 名字空间... -
net学习笔记及其他代码应用
2010-11-16 18:15:09由于有抽象类,它允许使用接口名作为引用变量的类型。通常的动态联编将生效。引用可以转换到接口类型或从接口类型转换,instanceof 运算符可以用来决定某对象的类是否实现了接口。 [Page] 39.启动一个线程是用run()... -
十天学会ASP.net--我认为ASP.NET比ASP难很多,希望大家做好准备
2008-12-05 08:41:032、用习惯VB的人很随便使用变量但是不申明,这在C#默认情况下是不允许的; 3、在向函数传递参数的时候要用圆括号:Response.Write "aa";是不允许的。 我说的这点几乎称不上是在说一种语言,一种语言的学习不仅仅需要... -
C#微软培训资料
2014-01-22 14:10:1718.2 在 C #代码中调用 C++和 VB 编写的组件 .240 18.3 版 本 控 制 .249 18.4 代 码 优 化 .252 18.5 小 结 .254 第五部分 附 录 .255 附录 A 关 键 字.255 附录 B 错 误 码.256 附录 C .Net 名字空间... -
Java开发技术大全(500个源代码).
2012-12-02 19:55:48boolExample.java 演示boolean变量的程序 charExample.java 演示char变量的程序 compare.java 演示前缀、后缀自加之间区别的程序 constCharExample.java 演示转义字符 converseNumber.java 逆向输出数字 ... -
Visual Basic 2008程序设计完全自学教程 2/2
2012-03-01 07:18:194.4.2 变量的作用域 4.5 数据类型转换 4.5.1 隐式数据类型转换 4.5.2 显示数据类型转换 4.6 Opion语句 4.6.1 OptionExplicit 4.6.2 OptionStrict 4.6.3 OptionCompare 4.6.4 Optionlnfer 4.7 自定义类型Structure与... -
Visual Basic 2008程序设计完全自学教程 1/2
2012-03-01 07:02:014.4.2 变量的作用域 4.5 数据类型转换 4.5.1 隐式数据类型转换 4.5.2 显示数据类型转换 4.6 Opion语句 4.6.1 OptionExplicit 4.6.2 OptionStrict 4.6.3 OptionCompare 4.6.4 Optionlnfer 4.7 自定义类型Structure与... -
新概念51单片机C语言教程 PDF电子书
2018-05-05 08:01:1912.1.2 指针变量的定义、赋值与引用 12.2 指针变量的运算 12.3 指针与数组 12.3.1 指针与一维数组 12.3.2 指针与多维数组 12.4 指针与函数 12.4.1 指针作为函数的参数 12.4.2 指向函数的指针 12.4.3 指针型函数 ... -
RMReport 7
2012-10-06 11:33:56用报表中数据字典,TRMReport.Dictionary.Variables,需要注意的是,如果变量是字符型的需要用AsString赋值,其他类型的用RMReport.Dictionary.Variables['var1'] := 1234,例如: RMReport1.LoadFromFile('1.rls'... -
在一小时内学会 C#(txt版本)
2009-08-19 18:09:37正如其名字说的,一旦它们已经进行了写操作、直接初始化或在构造函数中对其进行了赋值,readonly 数据成员就只能对其进行读取。readonly 和 const 数据成员不同之处在于 const 要求你在声明时进行直接初始化。看下面...