_Kai_
_Kai_
CC#
Created by _Kai_ on 3/23/2023 in #help
Stuck on some things involving listbox and textbox.
Hey I wanted to come back for a sec and let you guys know I'm done with the app, I got it to where it'd do most of what its supposed to and I also found someone I know irl that happens to know C# too, so I can reach out to him for help as well. More importantly I wanted to thank you both so much for how much time you took helping me out and being patient with me and genuinely explaining things. Your help made a huge difference for me. I immensely appreciate it beyond what I can express right now so again a huge huge thank you!! Have a good rest of your day/night 🙂
123 replies
CC#
Created by _Kai_ on 3/23/2023 in #help
Stuck on some things involving listbox and textbox.
Well it says the value of -1 isnt valid, so it has something to do with the way it is processing the values within the lists?
123 replies
CC#
Created by _Kai_ on 3/23/2023 in #help
Stuck on some things involving listbox and textbox.
it was rushed but i dont know what to change, the listbox2.select index is supposed to access whatever was selected from the "electronics, household, jewelry, etc" list
123 replies
CC#
Created by _Kai_ on 3/23/2023 in #help
Stuck on some things involving listbox and textbox.
okay this is the whole thing
123 replies
CC#
Created by _Kai_ on 3/23/2023 in #help
Stuck on some things involving listbox and textbox.
//namespace CSI_122_Final
{
public partial class Form1 : Form



{
private int nextID = 1;

public Form1()
{
InitializeComponent();
}

private void textBox1_TextChanged(object sender, EventArgs e)
{

}

private void Form1_Load(object sender, EventArgs e)
{

}

private void button2_Click(object sender, EventArgs e)
{
//This is the save button

if (listBox1.SelectedIndex >= 0)
{
listBox1.Items.Add("Record: #" + label6.Text + 1 + " " + textBox1.Text + " " + textBox2.Text
+ " " + textBox3.Text + " " + textBox4.Text + " Type of items purchased: " + listBox1.Items[listBox2.SelectedIndex]);


label6.Text = $" {nextID++}";

textBox1.Clear();
textBox1.Focus();
textBox2.Clear();
textBox2.Focus();
textBox3.Clear();
textBox3.Focus();
textBox4.Clear();
textBox4.Focus();

listBox2.ClearSelected();
}
else
{
MessageBox.Show("Input information in all fields");
}


}

private void button4_Click(object sender, EventArgs e)
{
//This is the delete button

if (listBox1.SelectedIndex >= -1)
{
listBox1.Items.RemoveAt(listBox1.SelectedIndex);
}
}

private void button1_Click(object sender, EventArgs e)
{
//this is the first button

listBox1.SelectedItem = listBox1.Items[0];
}

private void button3_Click(object sender, EventArgs e)
{
//this is the last button

listBox1.SelectedItem = listBox1.Items[listBox1.Items.Count-1];
}
}
}
//namespace CSI_122_Final
{
public partial class Form1 : Form



{
private int nextID = 1;

public Form1()
{
InitializeComponent();
}

private void textBox1_TextChanged(object sender, EventArgs e)
{

}

private void Form1_Load(object sender, EventArgs e)
{

}

private void button2_Click(object sender, EventArgs e)
{
//This is the save button

if (listBox1.SelectedIndex >= 0)
{
listBox1.Items.Add("Record: #" + label6.Text + 1 + " " + textBox1.Text + " " + textBox2.Text
+ " " + textBox3.Text + " " + textBox4.Text + " Type of items purchased: " + listBox1.Items[listBox2.SelectedIndex]);


label6.Text = $" {nextID++}";

textBox1.Clear();
textBox1.Focus();
textBox2.Clear();
textBox2.Focus();
textBox3.Clear();
textBox3.Focus();
textBox4.Clear();
textBox4.Focus();

listBox2.ClearSelected();
}
else
{
MessageBox.Show("Input information in all fields");
}


}

private void button4_Click(object sender, EventArgs e)
{
//This is the delete button

if (listBox1.SelectedIndex >= -1)
{
listBox1.Items.RemoveAt(listBox1.SelectedIndex);
}
}

private void button1_Click(object sender, EventArgs e)
{
//this is the first button

listBox1.SelectedItem = listBox1.Items[0];
}

private void button3_Click(object sender, EventArgs e)
{
//this is the last button

listBox1.SelectedItem = listBox1.Items[listBox1.Items.Count-1];
}
}
}
123 replies
CC#
Created by _Kai_ on 3/23/2023 in #help
Stuck on some things involving listbox and textbox.
ill switch rn
123 replies
CC#
Created by _Kai_ on 3/23/2023 in #help
Stuck on some things involving listbox and textbox.
it still says the same thing
123 replies
CC#
Created by _Kai_ on 3/23/2023 in #help
Stuck on some things involving listbox and textbox.
123 replies
CC#
Created by _Kai_ on 3/23/2023 in #help
Stuck on some things involving listbox and textbox.
im still trying to get rid of the exception
123 replies
CC#
Created by _Kai_ on 3/23/2023 in #help
Stuck on some things involving listbox and textbox.
i put everything under the “save” button into the “if” part of this, and put a messagebox.show(“input info in all fields”); in the “else” part. where would i put the customer class
123 replies
CC#
Created by _Kai_ on 3/23/2023 in #help
Stuck on some things involving listbox and textbox.
im just trying to get it to run without running into exceptions, even if it doesn’t totally work (at least for tonight, i have to be asleep in a couple hours)
123 replies
CC#
Created by _Kai_ on 3/23/2023 in #help
Stuck on some things involving listbox and textbox.
ohhh i think i understand. can i still make it work or would i have to redo the listbox entries?
123 replies
CC#
Created by _Kai_ on 3/23/2023 in #help
Stuck on some things involving listbox and textbox.
123 replies
CC#
Created by _Kai_ on 3/23/2023 in #help
Stuck on some things involving listbox and textbox.
oh right, sorry im running into mistakes like that bc i was really stressed but im calming down now
123 replies
CC#
Created by _Kai_ on 3/23/2023 in #help
Stuck on some things involving listbox and textbox.
123 replies
CC#
Created by _Kai_ on 3/23/2023 in #help
Stuck on some things involving listbox and textbox.
123 replies
CC#
Created by _Kai_ on 3/23/2023 in #help
Stuck on some things involving listbox and textbox.
123 replies
CC#
Created by _Kai_ on 3/23/2023 in #help
Stuck on some things involving listbox and textbox.
well it still says that the name doesn’t exist, but there are no bracket errors now
123 replies
CC#
Created by _Kai_ on 3/23/2023 in #help
Stuck on some things involving listbox and textbox.
i am taking more classes in the following months, thank you so much for all of your patience
123 replies
CC#
Created by _Kai_ on 3/23/2023 in #help
Stuck on some things involving listbox and textbox.
do i put it in brackets? putting it in class seems to throw the whole thing off because of these {}
123 replies