c#,
i have multiple arrays, When i click the submit button i want
all the data in the textboxes and the date to store in those arrays
respectively.
after that it prompts the user a yes or no dialog where if yes is
clicked the user enters more data and gets stored in the arrays(and
loops if yes is chosen again.)
when no is clicked the form closes.
how do i do this?
For example this is the first entry:
It stores this data into arrays for each:
Then i want to add another entry:
And stores this into the arrays.
Output will be like:
Code will be like:
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace CaptureWeatherDataForm
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public static string[] city=new string[10];
public static DateTime[] date=new DateTime[10];
public static string[] minTemp = new string[10];
public static string[] maxTemp = new string[10];
public static string[] precipitation = new string[10];
public static string[] humidity = new string[10];
public static string[] windSpeed = new string[10];
int count = 0;
bool condition = false;
private void button2_Click(object sender, EventArgs e)
{
do
{
city[count] = textBox1.Text;
date[count] = dateTimePicker1.Value;
minTemp[count] = textBox2.Text;
maxTemp[count] = textBox3.Text;
precipitation[count] = textBox4.Text;
humidity[count] = textBox5.Text;
windSpeed[count] = textBox6.Text;
count++;
string message = "Do you want to enter more?";
string title = "Message window";
MessageBoxButtons buttons = MessageBoxButtons.YesNo;
DialogResult result = MessageBox.Show(message, title,
buttons);
if (result == DialogResult.Yes)
{
condition = true;
textBox1.Text = "";
textBox2.Text = "";
textBox3.Text = "";
textBox4.Text = "";
textBox5.Text = "";
textBox6.Text = "";
}
else
{
condition = false;
}
}
while (condition == true);
}
private void button1_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
Please rate it if the above solution helps you in any way or if you have any concerns comment it, I will help you through again.
c#, i have multiple arrays, When i click the submit button i want all the data...
Create a program, Weather.java, which loads an unsorted set of weather data for Pendleton, sorts the data by date (handling date errors), and performs some analysis of the data (e.g. min/max temperature), and outputs the sorted data set to a file. Sample data: 2015-12-12,47,43,38,32,12,39,0.09,7,Rain,205 2015-05-08,73,56,38,18,7,22,0,0,,75 2015-11-10,51,44,37,18,8,21,0,4,,261 2016-02-02,45,36,26,12,5,14,0,1,,111 2015-06-28,109,89,68,38,11,48,T,0,Rain-Thunderstorm,296 Write methods to calculate each of the following on the given data set: Max. temperature Min. temperature Max. wind gust Max. precipitation and what the 'events' were for that day Each result...