[英]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.