Hi
i am new to c# program and have a problem in dealing with my listbox item. I hope you all can help.
i have a listbox and each item entered wil automatic been assign a string. This string is editable when user click on the edit button(a form will be appear for user to edit). Ok, now my problem is how can i allow the string to assign to the item and how to store back the string (if it had been edited) to the item again.
I am sorry if this question is simple to u all but please help and guide me along, thank u
Loading
Andrzej WegierskiPosted Sep 6, 2005, 6:45 AM
niciaPosted Sep 5, 2005, 10:17 PM
Below is my coding, can anyone please tell me which part of the my code is wrong. thank u
Form main
public ArrayList destination = new ArrayList();
private editForm edit;
public string getDest(){return this.destination[this.listBoxFile.SelectedIndex].ToString();}
public void setDest(string path){this.destination[this.listBoxFile.SelectedIndex] = path;}
public string getCustDest(){return this.destination[this.listBoxFile.SelectedIndex].ToString();}
public void setCustDest(string path){this.destination[this.listBoxFile.SelectedIndex] = path;}
private void buttonEdit_Click(object sender, System.EventArgs e){
this.destination.Add("Application Directory");
edit = new editForm(this);
edit.ShowDialog();
}
Form edit
private void information()
{
string dest = main.getDest();
this.comboDest.Text = dest;
if(dest=="[Custom]")
{
this.textDest.Text = main.getCustDest();
}
this.textSource.Text = main.link();
}
private void comboDest_SelectedIndexChanged(object sender, System.EventArgs e){
string select = (string)comboDest.SelectedItem;
main.setDest(select);
if(select == "[Custom]")
{
this.textDest.Enabled = true;
if(this.textDest.TextLength>0)
{
main.setCustDest(this.textDest.Text);
}
}
else
{
this.textDest.Enabled = false;
}
}