Click here to Skip to main content
15,880,905 members
Home / Discussions / C#
   

C#

 
GeneralHow to save combobox values in forms Pin
Member 1265992631-Jul-16 20:46
Member 1265992631-Jul-16 20:46 
GeneralRe: How to save combobox values in forms Pin
Richard MacCutchan31-Jul-16 21:23
mveRichard MacCutchan31-Jul-16 21:23 
GeneralRe: How to save combobox values in forms Pin
OriginalGriff31-Jul-16 21:27
mveOriginalGriff31-Jul-16 21:27 
GeneralRe: How to save combobox values in forms Pin
Member 126599261-Aug-16 19:00
Member 126599261-Aug-16 19:00 
GeneralRe: How to save combobox values in forms Pin
Pete O'Hanlon1-Aug-16 20:18
mvePete O'Hanlon1-Aug-16 20:18 
GeneralRe: How to save combobox values in forms Pin
Member 126599261-Aug-16 20:31
Member 126599261-Aug-16 20:31 
GeneralRe: How to save combobox values in forms Pin
Pete O'Hanlon1-Aug-16 20:35
mvePete O'Hanlon1-Aug-16 20:35 
GeneralRe: How to save combobox values in forms Pin
Member 126599261-Aug-16 22:38
Member 126599261-Aug-16 22:38 
here is the code that I have tried
Form1 has a single button.
Form1.cs
private int index = 0;
private void button1_Click(object sender, EventArgs e)
{

Form2 F2 = new Form2();
F2.SelectedIndex = index;
F2.ShowDialog();
index = F2.SelectedIndex;
}

Form2 has a combobox and a button
Form2.cs

int i = 0;
private void button1_Click(object sender, EventArgs e)
{
i = i + 1;
comboBox1.Items.Add("Message" + i);
}

public int SelectedIndex
{
get { return comboBox1.SelectedIndex; }
set { comboBox1.SelectedIndex = value; }
}

aboveis the code.on running the above.i clicked the button on form1 it opens form2.in form2 on cliking the button I have added items to form1.then I close the form2 and reopen it from form1 button.then also no item will be present in combobox on form2.
please let me know where I did wrong.
GeneralRe: How to save combobox values in forms Pin
Pete O'Hanlon1-Aug-16 23:36
mvePete O'Hanlon1-Aug-16 23:36 
GeneralRe: How to save combobox values in forms Pin
Member 126599261-Aug-16 23:39
Member 126599261-Aug-16 23:39 
GeneralRe: How to save combobox values in forms Pin
Pete O'Hanlon1-Aug-16 23:53
mvePete O'Hanlon1-Aug-16 23:53 
GeneralRe: How to save combobox values in forms Pin
Member 126599262-Aug-16 1:13
Member 126599262-Aug-16 1:13 
QuestionEF 6 and C# applications (Web & Windows) Pin
Zeyad Jalil31-Jul-16 20:20
professionalZeyad Jalil31-Jul-16 20:20 
AnswerRe: EF 6 and C# applications (Web & Windows) Pin
Nathan Minier1-Aug-16 3:50
professionalNathan Minier1-Aug-16 3:50 
AnswerRe: EF 6 and C# applications (Web & Windows) Pin
Gerry Schmitz1-Aug-16 5:21
mveGerry Schmitz1-Aug-16 5:21 
AnswerRe: EF 6 and C# applications (Web & Windows) Pin
Mycroft Holmes1-Aug-16 13:01
professionalMycroft Holmes1-Aug-16 13:01 
QuestionHow To Create Math Parser? Pin
Daniyaltjm31-Jul-16 2:12
Daniyaltjm31-Jul-16 2:12 
AnswerRe: How To Create Math Parser? Pin
OriginalGriff31-Jul-16 2:29
mveOriginalGriff31-Jul-16 2:29 
GeneralRe: How To Create Math Parser? Pin
Daniyaltjm31-Jul-16 4:07
Daniyaltjm31-Jul-16 4:07 
GeneralRe: How To Create Math Parser? Pin
OriginalGriff31-Jul-16 4:19
mveOriginalGriff31-Jul-16 4:19 
Questionneed help witch creating method Pin
Member 1138393529-Jul-16 23:55
Member 1138393529-Jul-16 23:55 
AnswerRe: need help witch creating method Pin
OriginalGriff30-Jul-16 0:11
mveOriginalGriff30-Jul-16 0:11 
QuestionParsing a string with multiple values - JSON or Retro? Pin
Michael Breeden29-Jul-16 1:48
Michael Breeden29-Jul-16 1:48 
AnswerRe: Parsing a string with multiple values - JSON or Retro? Pin
Richard Deeming29-Jul-16 2:09
mveRichard Deeming29-Jul-16 2:09 
GeneralRe: Parsing a string with multiple values - JSON or Retro? Pin
Michael Breeden29-Jul-16 2:43
Michael Breeden29-Jul-16 2:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.