| Paste number 71760: | form1 |
| Pasted by: | mromblad |
| When: | 6 months, 3 weeks ago |
| Share: | Tweet this! | http://paste.lisp.org/+1JDC |
| Channel: | None |
| Paste contents: |
using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.Win32;
using Microsoft.WindowsCE;
namespace mobileapplication1
{
public partial class SimpleSurvey : Form
{
Votedata x, y, z;
public string ChoiceA;
public string ChoiceB;
public string ChoiceC;
public SimpleSurvey()
{
InitializeComponent();
ChoiceA = Convert.ToString(Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\MorphInc\\", ChoiceA, ChoiceA));
ChoiceB = Convert.ToString(Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\MorphInc\\", ChoiceB, ChoiceB));
ChoiceC = Convert.ToString(Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\MorphInc\\", ChoiceC, ChoiceC));
radioButton1.Text = ChoiceA;
radioButton2.Text = ChoiceB;
radioButton3.Text = ChoiceC;
}
private void button3_Click(object sender, EventArgs e)
{
MessageBox.Show(x.GetCount() + " People chose " + ChoiceA + "\n" + y.GetCount() + " People chose" + ChoiceB + "\n" + z.GetCount() + " People chose " + ChoiceC);
}
private void button2_Click(object sender, EventArgs e)
{
if (radioButton1.Checked == true)
{
x.Increment();
MessageBox.Show("Thank You for Voting");
}
if (radioButton2.Checked == true)
{
y.Increment();
MessageBox.Show("Thank You for Voting");
}
if (radioButton3.Checked == true)
{
z.Increment();
MessageBox.Show("Thank You for Voting");
}
}
private void Form1_Closing(object sender, CancelEventArgs e)
{
x.Save();
y.Save();
z.Save();
Registry.SetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\MorphInc\\", ChoiceA, ChoiceA, RegistryValueKind.String);
Registry.SetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\MorphInc\\", ChoiceB, ChoiceB, RegistryValueKind.String);
Registry.SetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\MorphInc\\", ChoiceC, ChoiceC, RegistryValueKind.String);
}
private void Form1_Load(object sender, EventArgs e)
{
x = new Votedata("Choice1");
y = new Votedata("Choice2");
z = new Votedata("Choice2");
x.Load();
y.Load();
z.Load();
ChoiceA = Convert.ToString(Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\MorphInc\\", ChoiceA, ChoiceA));
ChoiceB = Convert.ToString(Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\MorphInc\\", ChoiceB, ChoiceB));
ChoiceC = Convert.ToString(Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\MorphInc\\", ChoiceC, ChoiceC));
}
private void menuItem2_Click(object sender, EventArgs e)
{
x.Save();
y.Save();
z.Save();
Registry.SetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\MorphInc\\", ChoiceA, ChoiceA, RegistryValueKind.String);
Registry.SetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\MorphInc\\", ChoiceB, ChoiceB, RegistryValueKind.String);
Registry.SetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\MorphInc\\", ChoiceC, ChoiceC, RegistryValueKind.String);
Application.Exit();
}
private void menuItem3_Click(object sender, EventArgs e)
{
x.Reset();
y.Reset();
z.Reset();
ChoiceA = "";
ChoiceB = "";
ChoiceC = "";
}
private void menuItem4_Click(object sender, EventArgs e)
{
ChoiceSet ChSt = new ChoiceSet();
ChSt.Show();
}
}
}
This paste has no annotations.