首页 > 编程语言 >C#如何弹出输入框 <弹出“添加引用”的窗口,找到名称为Microsoft.VisualBasic的组件>

C#如何弹出输入框 <弹出“添加引用”的窗口,找到名称为Microsoft.VisualBasic的组件>

时间:2022-10-18 14:36:39浏览次数:57  
标签:string 如何 C# System 输入框 InputBox using Microsoft VisualBasic

1、菜单栏,选择【项目】;然后在弹出的菜单中选择【添加引用】

 

2、弹出“添加引用”的窗口,找到名称为Microsoft.VisualBasic的组件,选择它并点击【确定】

 

3、使用命名空间Microsoft.VisualBasic。添加代码:using Microsoft.VisualBasic;

using Microsoft.VisualBasic;

4、在窗体中添加一个Button1和textBox1。我们要实现点击button1,用textBox1显示输入的文本的内容。

 

5、

调用VB中的InputBox,输入一串字符串。给按钮添加代码:

string str = Interaction.InputBox("提示信息","标题","文本内容",-1,-1);

Interaction.InputBox的格式:string  Interaction .InputBox(string Prompt,  string title,   string  Defaultresponce,  int Xpos,   int Ypose)

 6、参考代码:

 1 using System;
 2 using System.Collections.Generic;
 3 using System.ComponentModel;
 4 using System.Data;
 5 using System.Drawing;
 6 using System.Linq;
 7 using System.Text;
 8 using System.Windows.Forms;
 9 using Microsoft.VisualBasic;
10 
11 namespace WindowsFormsApplication1
12 {
13     public partial class Form1 : Form
14     {
15         public Form1()
16         {
17             InitializeComponent();
18         }
19 
20         private void Form1_Load(object sender, EventArgs e)
21         {
22 
23         }
24 
25         private void button1_Click(object sender, EventArgs e)
26         {
27             string str = Interaction.InputBox("提示信息","标题","文本内容",-1,-1);
28             
29             textBox1.Text = str;
30         }
31     }
32 }

7、结果显示:

Microsoft.VisualBasic.Information.IsNumeric(s)    判断当前文本是否是数字

标签:string,如何,C#,System,输入框,InputBox,using,Microsoft,VisualBasic
From: https://www.cnblogs.com/ZBO123/p/16802429.html

相关文章

  • 【备忘】Eclipse内存泄漏分析工具MAT - Memory Analyzer Tools
    下载https://www.eclipse.org/mat/downloads.phpLinux上生成HeapDump使用jdk的命令/path/to/jdk/bin/jmap-dump:format=b,file=<文件名XX.hprof><pid>为MAT配置JD......
  • NC14602 xinjun与阴阳师
    链接:https://ac.nowcoder.com/acm/problem/14602来源:牛客网**题目描述**xinjun是各类手游的狂热粉丝,因随手一氪、一氪上千而威震工大,现在他迷上了阴阳师。xinjun玩手游......
  • malab 批处理将结果追加输出到csv文件中
    clcclearallfilename1='.\内蒙古自治区锡林郭勒盟典型草原轮牧放牧样地群落结构监测数据集(201.csv'%对fid=fopen('result3.txt','a+');%%B=readmatrix(fi......
  • Linux split package into more parts
    Sometimestheirsinglepackagespaceislimited,justlikenobiggerthan10Mforeachdocument,intheseconditions,weneedsplitthebigoneintomorepiece......
  • 10. CSS文本格式化
    1.前言通过CSS中的文本属性您可以像操作Word文档那样定义网页中文本的字符间距、对齐方式、缩进等等,CSS中常用的文本属性如下所示:text-align:设置文本的水平对齐方......
  • CodeForces 709C Letters Cyclic Shift
    C.LettersCyclicShifttimelimitpertestmemorylimitpertestinputoutputsconsistingoflowercaseEnglishletters.Youhavetopickexactlyonenon-emptysubs......
  • C语言初级阶段3——循环与分支
    C语言初级阶段3——循环与分支流程控制1.定义:流程控制结构是指能够改变程序执行顺序的结构,他们可以根据不同的条件在一段或多段程序中选择一个运行或者不运行。2.分类(1......
  • Lucene.net(4.8.0) 学习问题记录二: 分词器Analyzer中的TokenStream和AttributeSource
    前言:目前自己在做使用Lucene.net和PanGu分词实现全文检索的工作,不过自己是把别人做好的项目进行迁移。因为项目整体要迁移到ASP.NETCore2.0版本,而Lucene使用的版本是3.6.......
  • 32 位MCU单片机资料 STM32L4R9ZIY6P规格 特点
    STM32L4+系列微控制器具有更高性能(高达120MHz)和更大嵌入式内存(高达2M字节的闪存和640K字节的SRAM)。STM32L4+具有更丰富的图形和连接功能,同时保持同类最佳的超低功耗。STM32L......
  • VS控件-BackgroundWorker
      查询了一下MSDN文档,其中微软就BackgroundWorker类的功能有这么一个描述(英文的,根据个人理解翻译):BackgroundWorker类允许您在单独的线程上执行某个可能导致用户界面(UI)......