vb编程题每单击命令按钮一次,就选中下一个单选按钮

vb编程题每单击命令按钮一次,就选中下一个单选按钮,第1张

代码如下:

Option Explicit

Private Sub cmd1_Click()

  If opt1(0)Value = True Then

      opt1(1)Value = True

  ElseIf opt1(1)Value = True Then

      opt1(2)Value = True

  ElseIf opt1(2)Value = True Then

      opt1(3)Value = True

  ElseIf opt1(3)Value = True Then

      opt1(0)Value = True

  End If

End Sub

Private Sub Form_Load()

  opt1(0)Value = True

End Sub

#region 计算器按钮事件

float first; //这个变量用来接受输入的第一个数

float second; //这个变量用来接收输入的第二个数

float last;//这个变量用来取得计算结果

string state;//这个变量用来表示计算模式

/// <summary>

/// 0按键

/// </summary>

/// <param name="sender"></param>

/// <param name="e"></param>

private void btn0_Click_1(object sender, EventArgs e)

{

textBox5Text += btn0Text;

}

/// <summary>

/// 1按键

/// </summary>

/// <param name="sender"></param>

/// <param name="e"></param>

private void btn1_Click(object sender, EventArgs e)

{

textBox5Text += btn1Text;

}

/// <summary>

/// 2按键

/// </summary>

/// <param name="sender"></param>

/// <param name="e"></param>

private void btn2_Click_1(object sender, EventArgs e)

{

textBox5Text += btn2Text;

}

/// <summary>

/// 3按键

/// </summary>

/// <param name="sender"></param>

/// <param name="e"></param>

private void btn3_Click_1(object sender, EventArgs e)

{

textBox5Text += btn3Text;

}

/// <summary>

/// 4按键

/// </summary>

/// <param name="sender"></param>

/// <param name="e"></param>

private void btn4_Click_1(object sender, EventArgs e)

{

textBox5Text += btn4Text;

}

/// <summary>

/// 5按键

/// </summary>

/// <param name="sender"></param>

/// <param name="e"></param>

private void btn5_Click_1(object sender, EventArgs e)

{

textBox5Text += btn5Text;

}

/// <summary>

/// 6按键

/// </summary>

/// <param name="sender"></param>

/// <param name="e"></param>

private void btn6_Click_1(object sender, EventArgs e)

{

textBox5Text += btn6Text;

}

/// <summary>

/// 7按键

/// </summary>

/// <param name="sender"></param>

/// <param name="e"></param>

private void btn7_Click_1(object sender, EventArgs e)

{

textBox5Text += btn7Text;

}

/// <summary>

/// 8按键

/// </summary>

/// <param name="sender"></param>

/// <param name="e"></param>

private void btn8_Click_1(object sender, EventArgs e)

{

textBox5Text += btn8Text;

}

/// <summary>

/// 9按键

/// </summary>

/// <param name="sender"></param>

/// <param name="e"></param>

private void btn9_Click(object sender, EventArgs e)

{

textBox5Text += btn9Text;

}

/// <summary>

/// /按键

/// </summary>

/// <param name="sender"></param>

/// <param name="e"></param>

private void btnCHU_Click_1(object sender, EventArgs e)

{

state = "除";

//textBox1Text += btnCHUText;

first = floatParse(textBox5Text);

//textBox1Text += btnJIAText;

textBox5Text = null;

}

/// <summary>

/// ←按键

/// </summary>

/// <param name="sender"></param>

/// <param name="e"></param>

private void btnSQRT_Click_1(object sender, EventArgs e)

{

if (textBox5Text != "")

{

textBox5Text = textBox5TextRemove(textBox5TextLength - 1);

}

else

{

MessageBoxShow("输入有误");

}

}

/// <summary>

/// C按键

/// </summary>

/// <param name="sender"></param>

/// <param name="e"></param>

private void button8_Click_1(object sender, EventArgs e)

{

textBox5Text = "";

}

/// <summary>

/// 按键

/// </summary>

/// <param name="sender"></param>

/// <param name="e"></param>

private void btnCHENG_Click_1(object sender, EventArgs e)

{

state = "乘";

//textBox1Text += btnCHENGText;

first = floatParse(textBox5Text);

//textBox1Text += btnJIAText;

textBox5Text = null;

}

/// <summary>

/// -按键

/// </summary>

/// <param name="sender"></param>

/// <param name="e"></param>

private void btnJIAN_Click_1(object sender, EventArgs e)

{

state = "减";

//textBox1Text += btnJIANText;

first = floatParse(textBox5Text);

//textBox1Text += btnJIAText;

textBox5Text = null;

}

/// <summary>

/// +按键

/// </summary>

/// <param name="sender"></param>

/// <param name="e"></param>

private void btnJIA_Click_1(object sender, EventArgs e)

{

state = "加";

first = floatParse(textBox5Text);

//textBox1Text += btnJIAText;

textBox5Text = null;

}

/// <summary>

/// sqrt按键

/// </summary>

/// <param name="sender"></param>

/// <param name="e"></param>

private void button7_Click_1(object sender, EventArgs e)

{

first = floatParse(thistextBox5Text);

last = first first;

thistextBox5Text = lastToString();

}

/// <summary>

/// 按键

/// </summary>

/// <param name="sender"></param>

/// <param name="e"></param>

private void btnD_Click_1(object sender, EventArgs e)

{

textBox5Text += btnDText;

}

private void btnBAI_Click_1(object sender, EventArgs e)

{

}

/// <summary>

/// =按钮事件

/// </summary>

/// <param name="sender"></param>

/// <param name="e"></param>

private void btnZF_Click_1(object sender, EventArgs e)

{

try

{

second = floatParse(textBox5Text);

if (state == "加")

{

last = first + second;

thistextBox5Text = lastToString();

}

else if (state == "减")

{

last = first - second;

thistextBox5Text = lastToString();

}

else if (state == "乘")

{

last = first second;

thistextBox5Text = lastToString();

}

else if (state == "除")

{

if (second != 0)

{

last = first / second;

thistextBox5Text = lastToString();

}

else

{

textBox5Text = "被除数不能为0!";

}

}

else

{

textBox5Text = "请输入!";

}

}

catch (Exception)

{

MessageBoxShow("请输入数字!");

}

}

你的意思是问在哪里编辑这些代码吧

你直接双击某一个控件,就直接跳到后台编辑界面了!或者你对着Form文件右键点“查看代码”也是可以的!

以上就是关于vb编程题每单击命令按钮一次,就选中下一个单选按钮全部的内容,包括:vb编程题每单击命令按钮一次,就选中下一个单选按钮、C#的应用程序一个入门级的问题请教,在Form上点击一个button后程序指向哪个方法、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zz/10135242.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-05
下一篇2023-05-05

发表评论

登录后才能评论

评论列表(0条)

    保存