Visual Studio 2005 里面关于 textbox获取checkbox的值问题 !!求救!!

2025-04-14 19:58:38
推荐回答(2个)
回答1:

这个不是很简单么?
你在form2.button的代码中,加入设定form1.textbox.text的语句不就可以了。textbox控件在定义(或声明)的时候,应该都是public的,在别的窗体也可以直接访问的。

public sub Button_Click(handle,e) 'handles ...handles这部分就不写了
dim str as string = ""
if(checkbox1.checked) then
str = str & checkbox1.text
end if
if(checkbox2.checked) then
str = str & checkbox2.text
end if
if(checkbox3.checked) then
str = str & checkbox3.text
end if

form1.textbox.text= str
end sub

回答2:

你可以参考下: