private void button2_Click(object sender, EventArgs e) { this.Hide(); RoomList f1 = new RoomList(); f1.Show(); }
private void button1_Click(object sender, EventArgs e) { count++; var file = @"C:\Users\anusha\Documents\Visual Studio 2013\Projects\sesprint1\sesprint1\count.csv"; List <string> example = new List <string>(); example.Add(count.ToString()); File.WriteAllLines(file, example); Boolean errorFlag = false; var rm = new Node(); try { rm.roomName = textBox1.Text; rm.O_Vtemperature = Double.Parse(textBox2.Text); rm.O_VWater = Double.Parse(textBox3.Text); rm.O_VHumidity = Double.Parse(textBox4.Text); rm.O_VSoilAcidity = Double.Parse(textBox5.Text); rm.O_VPlantBed = Double.Parse(textBox6.Text); rm.O_VFertilizer = Double.Parse(textBox7.Text); rm.O_VLighting = Double.Parse(textBox8.Text); if (rm.roomName == "") { rm.roomName = "room" + count; } } catch (FormatException) { MessageBox.Show("Please enter double datatype values"); errorFlag = true; } catch (NullReferenceException) { // textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; textBox5.Text = ""; textBox6.Text = ""; textBox7.Text = ""; textBox8.Text = ""; } if (errorFlag == false) { MessageBox.Show("Room added successfully"); this.Hide(); RoomList f1 = new RoomList(); Room f2 = new Room(rm); f1.createnode(rm.roomName); f1.Show(); } }