namespace Check
{
public partial class FormMain : Form
{
private void FormMain_Load(object sender, EventArgs e)
{
InitItem();
}
public void InitItem()
{
Dictionary<string, Healitems> item = new Dictionary<string, Healitems>();
Healitems check = new Healitems("身高", 6, "测量身高"); item .Add(check.name, check);
} private void btnprint_Click(object sender, EventArgs e)
{ MessageBox.Show("检查项目名称: {0}", ????);
想再这个处理时间中用InitItem() 方法中数组, 如何使用?
}
}
}
}
{
public partial class FormMain : Form
{
private void Fo_Load(object sender,EventArgs e)
{
InitItem();
}
public void InitItem()
{
Dictionary <string, it> i =new Dictionary <string,it> ();
it check=new Healitems( "身高 ", 6, "测量身高 "); item .Add(check.name, check);
}
private void btnprint_Click(object sender, EventArgs e)
{ MessageBox.Show( "检查项目名称: {0} ", ????);
想再这个处理时间中用InitItem() 方法中数组, 如何使用?
} }}
不好意思 没想到编辑的数禁这么差 重新整理给大家
namespace Check
{
public partial class FormMain : Form
{
private void FormMain_Load(object sender, EventArgs e)
{
InitItem();
}
static Dictionary <string, Healitems> item =null;//放在这里声明
public void InitItem()
{
item = new Dictionary <string, Healitems> ();
Healitems check = new Healitems( "身高 ", 6, "测量身高 "); item .Add(check.name, check);
} private void btnprint_Click(object sender, EventArgs e)
{
if(item!=null){
foreach(string str in item.Keys){
MessageBox.Show( "检查项目名称: {0} ", str);
}
}
}
}
}
}