[英]Attempting to Make Quiz Application. How can I temporarily automatically store combo-box values in a database
[英]How can i store values of some text box in a item of a list box?? without a database., but by using array
我们需要将存储textbox.text
在单个项目中index.if
选择的指数的变化在文本框也应该改变.the文本
private void button1_Click(object sender, EventArgs e)
{
if (listBox1.SelectedIndex == 0)
{
tb[0].Text = textBox1.Text;
tb[1].Text = textBox2.Text;
tb[2].Text = textBox3.Text;
tb[3].Text = textBox4.Text;
tb[4].Text = textBox5.Text;
}
if (listBox1.SelectedIndex == 1)
{
t[0].Text = textBox1.Text;
t[1].Text = textBox2.Text;
t[2].Text = textBox3.Text;
t[3].Text = textBox4.Text;
t[4].Text = textBox5.Text;
}
你可以轻松地使用JavaScript。 在下拉列表更改事件上调用programTitleChange()javascript函数。
Javascript功能:
function programTitleChange(elm) {
if (elm.options[elm.selectedIndex].text != "Select") {
document.getElementById('txtTitle').value =
elm.options[elm.selectedIndex].text;
document.getElementById('txtTitle').readOnly = true;
}
else {
document.getElementById('txtTitle').value = "";
document.getElementById('txtTitle').readOnly = false;
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.