Printing previous items in List C# [on hold]
up vote
-3
down vote
favorite
I'm having trouble with the logic to fill textboxs with the previous stored data in the List<>. The code should save the fields in a class and then when the user hits the back button, I need to display the last stored item in the list. The same goes for clicking on the next button. I don't know how to fill textboxs with the previous stored data in the List<>. This is a WPF application. Thank you for any help.
public partial class MainWindow : Window
{
//these lines of code imports the date/time function and the random function
DateTime time = DateTime.Now;
Random rnd = new Random();
String addresses;
String cities;
String states;
String zipcodes;
string num = "";
public List<Order> orderlist = new List<Order>();
public class Order
{
public string city { set; get; }
public string zipcode { set; get; }
public string state { set; get; }
public string orderNum { set; get; }
public string address { set; get; }
}
public MainWindow()
{
InitializeComponent();
}
private void scanBtn_Click(object sender, RoutedEventArgs e)
{
//this displays the current date and time in the arrived at textbox
arrivedAtTextbox.Text = "" + time;
//this code generates a random number and converts to a string to be displayed
int id = rnd.Next(1000);
num = id.ToString();
packageIDTextbox.Text = num;
//these lines of code enables the fields after the scan button was clicked
addressTextbox.IsEnabled = true;
cityTextbox.IsEnabled = true;
zipCodeTextbox.IsEnabled = true;
stateComboBox.IsEnabled = true;
//this code sets the focus to the address field
addressTextbox.Focus();
addresses = addressTextbox.Text;
cities = cityTextbox.Text;
zipcodes = zipCodeTextbox.Text;
states = stateComboBox.Text;
}
//Add Button
private void addBtn_Click(object sender, RoutedEventArgs e)
{
Order data = new Order();
data.address = addresses;
data.city = cities;
data.zipcode = zipcodes;
data.state = states;
data.orderNum = num;
orderlist.Add(data);
}
//Remove Button
private void Button_Click(object sender, RoutedEventArgs e)
{
}
//Next Button
private void Button_Click_1(object sender, RoutedEventArgs e)
{
}
}
c#
put on hold as off-topic by Heslacher, BCdotWEB, t3chb0t, Toby Speight, πάντα ῥεῖ 9 hours ago
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Heslacher, BCdotWEB, t3chb0t, Toby Speight, πάντα ῥεῖ
If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
up vote
-3
down vote
favorite
I'm having trouble with the logic to fill textboxs with the previous stored data in the List<>. The code should save the fields in a class and then when the user hits the back button, I need to display the last stored item in the list. The same goes for clicking on the next button. I don't know how to fill textboxs with the previous stored data in the List<>. This is a WPF application. Thank you for any help.
public partial class MainWindow : Window
{
//these lines of code imports the date/time function and the random function
DateTime time = DateTime.Now;
Random rnd = new Random();
String addresses;
String cities;
String states;
String zipcodes;
string num = "";
public List<Order> orderlist = new List<Order>();
public class Order
{
public string city { set; get; }
public string zipcode { set; get; }
public string state { set; get; }
public string orderNum { set; get; }
public string address { set; get; }
}
public MainWindow()
{
InitializeComponent();
}
private void scanBtn_Click(object sender, RoutedEventArgs e)
{
//this displays the current date and time in the arrived at textbox
arrivedAtTextbox.Text = "" + time;
//this code generates a random number and converts to a string to be displayed
int id = rnd.Next(1000);
num = id.ToString();
packageIDTextbox.Text = num;
//these lines of code enables the fields after the scan button was clicked
addressTextbox.IsEnabled = true;
cityTextbox.IsEnabled = true;
zipCodeTextbox.IsEnabled = true;
stateComboBox.IsEnabled = true;
//this code sets the focus to the address field
addressTextbox.Focus();
addresses = addressTextbox.Text;
cities = cityTextbox.Text;
zipcodes = zipCodeTextbox.Text;
states = stateComboBox.Text;
}
//Add Button
private void addBtn_Click(object sender, RoutedEventArgs e)
{
Order data = new Order();
data.address = addresses;
data.city = cities;
data.zipcode = zipcodes;
data.state = states;
data.orderNum = num;
orderlist.Add(data);
}
//Remove Button
private void Button_Click(object sender, RoutedEventArgs e)
{
}
//Next Button
private void Button_Click_1(object sender, RoutedEventArgs e)
{
}
}
c#
put on hold as off-topic by Heslacher, BCdotWEB, t3chb0t, Toby Speight, πάντα ῥεῖ 9 hours ago
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Heslacher, BCdotWEB, t3chb0t, Toby Speight, πάντα ῥεῖ
If this question can be reworded to fit the rules in the help center, please edit the question.
1
I'm afraid this question does not match what this site is about. Code Review is about improving existing, working code. Code Review is not the site to ask for help in fixing or changing what your code does. Once the code does what you want, we would love to help you do the same thing in a cleaner way! Please see our help center for more information.
– Heslacher
10 hours ago
add a comment |
up vote
-3
down vote
favorite
up vote
-3
down vote
favorite
I'm having trouble with the logic to fill textboxs with the previous stored data in the List<>. The code should save the fields in a class and then when the user hits the back button, I need to display the last stored item in the list. The same goes for clicking on the next button. I don't know how to fill textboxs with the previous stored data in the List<>. This is a WPF application. Thank you for any help.
public partial class MainWindow : Window
{
//these lines of code imports the date/time function and the random function
DateTime time = DateTime.Now;
Random rnd = new Random();
String addresses;
String cities;
String states;
String zipcodes;
string num = "";
public List<Order> orderlist = new List<Order>();
public class Order
{
public string city { set; get; }
public string zipcode { set; get; }
public string state { set; get; }
public string orderNum { set; get; }
public string address { set; get; }
}
public MainWindow()
{
InitializeComponent();
}
private void scanBtn_Click(object sender, RoutedEventArgs e)
{
//this displays the current date and time in the arrived at textbox
arrivedAtTextbox.Text = "" + time;
//this code generates a random number and converts to a string to be displayed
int id = rnd.Next(1000);
num = id.ToString();
packageIDTextbox.Text = num;
//these lines of code enables the fields after the scan button was clicked
addressTextbox.IsEnabled = true;
cityTextbox.IsEnabled = true;
zipCodeTextbox.IsEnabled = true;
stateComboBox.IsEnabled = true;
//this code sets the focus to the address field
addressTextbox.Focus();
addresses = addressTextbox.Text;
cities = cityTextbox.Text;
zipcodes = zipCodeTextbox.Text;
states = stateComboBox.Text;
}
//Add Button
private void addBtn_Click(object sender, RoutedEventArgs e)
{
Order data = new Order();
data.address = addresses;
data.city = cities;
data.zipcode = zipcodes;
data.state = states;
data.orderNum = num;
orderlist.Add(data);
}
//Remove Button
private void Button_Click(object sender, RoutedEventArgs e)
{
}
//Next Button
private void Button_Click_1(object sender, RoutedEventArgs e)
{
}
}
c#
I'm having trouble with the logic to fill textboxs with the previous stored data in the List<>. The code should save the fields in a class and then when the user hits the back button, I need to display the last stored item in the list. The same goes for clicking on the next button. I don't know how to fill textboxs with the previous stored data in the List<>. This is a WPF application. Thank you for any help.
public partial class MainWindow : Window
{
//these lines of code imports the date/time function and the random function
DateTime time = DateTime.Now;
Random rnd = new Random();
String addresses;
String cities;
String states;
String zipcodes;
string num = "";
public List<Order> orderlist = new List<Order>();
public class Order
{
public string city { set; get; }
public string zipcode { set; get; }
public string state { set; get; }
public string orderNum { set; get; }
public string address { set; get; }
}
public MainWindow()
{
InitializeComponent();
}
private void scanBtn_Click(object sender, RoutedEventArgs e)
{
//this displays the current date and time in the arrived at textbox
arrivedAtTextbox.Text = "" + time;
//this code generates a random number and converts to a string to be displayed
int id = rnd.Next(1000);
num = id.ToString();
packageIDTextbox.Text = num;
//these lines of code enables the fields after the scan button was clicked
addressTextbox.IsEnabled = true;
cityTextbox.IsEnabled = true;
zipCodeTextbox.IsEnabled = true;
stateComboBox.IsEnabled = true;
//this code sets the focus to the address field
addressTextbox.Focus();
addresses = addressTextbox.Text;
cities = cityTextbox.Text;
zipcodes = zipCodeTextbox.Text;
states = stateComboBox.Text;
}
//Add Button
private void addBtn_Click(object sender, RoutedEventArgs e)
{
Order data = new Order();
data.address = addresses;
data.city = cities;
data.zipcode = zipcodes;
data.state = states;
data.orderNum = num;
orderlist.Add(data);
}
//Remove Button
private void Button_Click(object sender, RoutedEventArgs e)
{
}
//Next Button
private void Button_Click_1(object sender, RoutedEventArgs e)
{
}
}
c#
c#
asked 10 hours ago
Jeff Ryan
72
72
put on hold as off-topic by Heslacher, BCdotWEB, t3chb0t, Toby Speight, πάντα ῥεῖ 9 hours ago
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Heslacher, BCdotWEB, t3chb0t, Toby Speight, πάντα ῥεῖ
If this question can be reworded to fit the rules in the help center, please edit the question.
put on hold as off-topic by Heslacher, BCdotWEB, t3chb0t, Toby Speight, πάντα ῥεῖ 9 hours ago
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Heslacher, BCdotWEB, t3chb0t, Toby Speight, πάντα ῥεῖ
If this question can be reworded to fit the rules in the help center, please edit the question.
1
I'm afraid this question does not match what this site is about. Code Review is about improving existing, working code. Code Review is not the site to ask for help in fixing or changing what your code does. Once the code does what you want, we would love to help you do the same thing in a cleaner way! Please see our help center for more information.
– Heslacher
10 hours ago
add a comment |
1
I'm afraid this question does not match what this site is about. Code Review is about improving existing, working code. Code Review is not the site to ask for help in fixing or changing what your code does. Once the code does what you want, we would love to help you do the same thing in a cleaner way! Please see our help center for more information.
– Heslacher
10 hours ago
1
1
I'm afraid this question does not match what this site is about. Code Review is about improving existing, working code. Code Review is not the site to ask for help in fixing or changing what your code does. Once the code does what you want, we would love to help you do the same thing in a cleaner way! Please see our help center for more information.
– Heslacher
10 hours ago
I'm afraid this question does not match what this site is about. Code Review is about improving existing, working code. Code Review is not the site to ask for help in fixing or changing what your code does. Once the code does what you want, we would love to help you do the same thing in a cleaner way! Please see our help center for more information.
– Heslacher
10 hours ago
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
1
I'm afraid this question does not match what this site is about. Code Review is about improving existing, working code. Code Review is not the site to ask for help in fixing or changing what your code does. Once the code does what you want, we would love to help you do the same thing in a cleaner way! Please see our help center for more information.
– Heslacher
10 hours ago