/*
*程序的版权和版本声明部分:
*程序的版权和版本声明部分:
*Copyright(c)2013,烟台大学计算机学院学生
*All rights reserved.
*文件名称:
*作者:尚振伟
*完成日期:2014年11月6日
*版本号:v0.1
*对任务及求解方法的描述部分:
*输入描述:无
*问题描述:窗体上有两个文本框:一个文本框中最多输入字符6个;一个文本框中输入任何内容都显示*号。再添加一个按钮、2个单选按钮。实现单击按钮后,根据单选按钮,将对应文本框中内容显示在标签
*程序输入:
*程序输出:
*问题分析:
*算法设计:
*我的程序:
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication3
{
public partial class Form1 : Form
{
String str;
public Form1()
{
InitializeComponent();
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
textBox1.MaxLength = 6;
}
private void textBox2_TextChanged(object sender, EventArgs e)
{
textBox2.PasswordChar='*';
}
private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
str=textBox1.Text;
}
private void radioButton2_CheckedChanged(object sender, EventArgs e)
{
str = textBox2.Text;
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button2_Click(object sender, EventArgs e)
{
label1.Text = str;
}
private void label1_Click(object sender, EventArgs e)
{
}
}
}
结果展示:
心得体会:多练才行。