Please bear with me, I am coming from a VB environment to Visual C# (2010 express).
I am having a problem with understanding how to call a class if a radio button is checked then a cmdRun_Click is pressed. Can it be called/instantiated this way?
See the else if (rdoBDS.Checked) line.
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void cmdExit_Click(object sender, EventArgs e)
{
this.Close();
}
List<string> _items = new List<string>();
private void cmdRun_Click(object sender, EventArgs e)
{
if (rdoMicroStation.Checked)
_items.Add("MicroStation - Edit Icon Properties to switch departments, Bridge is the default.");
else if (rdoRoad.Checked)
_items.Add("Road Design Icons V7V8, V8, and Modeler");
else if (rdoPhotoSurvey.Checked)
_items.Add("Photos and Survey Icons V7V8, V8 and Land Surveyor");
else if (rdoField.Checked)
_items.Add("Field = Road and Photo-Survey and Land Surveyor Icons");
else if (rdoBDS.Checked)
_items.Add("Bridge Deck Survey Icons and database setup");
BridgeDeckSurvey bdsstuff = new BridgeDeckSurvey();
listBox1.DataSource = _items;
listBox1.DataSource = null;
listBox1.DataSource = _items;
}
private void rdoBDS_CheckedChanged(object sender, EventArgs e)
{
}
}
}
public class BridgeDeckSurvey
{
public static void BDSReg(string[] args)
{
string filePath = "O:\\cad_std\\configs\\_Select_A_setup\\Setup_08_11_XP_Win7\\bds_odbc_xp.reg";
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.EnableRaisingEvents = false;
proc.StartInfo.FileName = filePath;
proc.Start();
goto AppendIni;
AppendIni:
try
{
StreamWriter sw = new StreamWriter("C:\\Windows\\odbc.ini");
sw.WriteLine("BDS=Microsoft Access Driver (*.mdb, *.accdb) (32 bit)");
sw.Close();
}
catch (IOException e)
{
Console.WriteLine("An IO Exception Occurred:" + e.Message);
}
finally
{
Console.WriteLine("Finished");
}
}
}