
正文
vb.net接收参数 vb参数传递
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
VB.NET 命令行,一个程序启动时接收命令行启动参数的程序 怎样做?
添加一个全局类,添加一个 Main 静态方法,让它接收一个类型为字符串数组的参数,并设置项目属性的启动项目为Main函数即可。
但是要注意在Main函数中运行窗体。Application.Run()
相关问答
Q1: VB.net 两个窗体之间传递参数
新窗体中写
构造函数
,然后调用。
比如你要调用的新窗体是From1.cs这个窗体,
public
Form1(要传入的参数)
{
//把传入的参数传入窗体中
//执行窗体标准内容
}
然后在需要调用的地方调用
Form1
f
=
new
Form1(传出的参数);
'--------Form1--------
Dim
f2
As
Form2
Private
Sub
Command1_Click()
Set
f2
=
New
Form2
f2.Show
vbModal
End
Sub
'--------Form1
End--------
'--------Form2--------
Dim
WithEvents
f3
As
Form3
Private
Sub
Command1_Click()
Set
f3
=
New
Form3
f3.Show
End
Sub
Public
Sub
f3_f2W()
Me.Command1.Caption
=
"f2W"
End
Sub
'--------Form2
End--------
'--------Form3--------
Public
Event
f2W()
Private
Sub
Command1_Click()
RaiseEvent
f2W
End
Sub
'--------Form3
End--------
f.Show();
如此就能实现调用了。
Q2: 求教VB.NET如何获取进程的命令行参数
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim a As String
a = Microsoft.VisualBasic.Command 'a是发送给程序的命令
End Sub
End Class
Q3: vb.net运行所在目录的应用程序并加参数
可试试下面vb.net接收参数的方法vb.net接收参数:
1.可接收参数vb.net接收参数的外部程序
/// summary
/// 可接收参数的外部程序主函数
/// /summary
static class Program
{
/// summary
/// The main entry point for the application.
/// /summary
[STAThread]
static void Main(string[] paras)
{
string temp = "";
foreach (string str in paras)
{
temp += str + ",";
}
MessageBox.Show(temp);
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
2.启动外部程序的方法(给外部程序加参数)
/// summary
/// 调用外部程序窗体
/// /summary
public partial class Invokeprogram : Form
{
public Invokeprogram()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.CreateNoWindow = true;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.FileName = Application.StartupPath + "\\WindowsFormsApplication1.exe";
proc.StartInfo.Arguments = "-steam -game cstrike"; //传入启动参数
proc.Start();
//string output = proc.StandardOutput.ReadToEnd();
// MessageBox.Show(output);
}
}
Q4: VB.net串口通讯接收数据写法
Do
Application.DoEvents()
Loop Until MSComm1.InBufferCount = 13
Dim a As String = MSComm1.Input
Label1.Caption = a.Substring(1, 9)
Label2.Caption = a.Substring(10, 3)
Q5: 急急急!!!请问如何在VB.NET中通过URL传参和在新的页面接收参数的值呢【Web网站】
在发送页面用get:如点击button时response.redirect("接收页的url"?canshu=textbox.text)
;
然后在接收页面用Request.QueryString["canshu"].toString(); 这样就接受到textbox里的值了。
关于vb.net接收参数和vb参数传递的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。







