C# WindowsForms App in Visual Studio 2015 community. I create combobox item with 2 values When i create button and whant add compare condition.
client its string = text selected in combobox
If client = text1 value - launch app1
If client = text2 value - launch app2
But when i use equal function i get error.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Diagnostics;
namespace WindowsFormsApplication3
public partial class Form1 : Form
string client;
public Form1()
InitializeComponent();
public void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
comboBox1.DisplayMember.ToString();
string client = comboBox1.Text;
public void button1_Click_1(object sender, EventArgs e)
if (client.Equals("notepad"))
Process.Start("notepad.exe");
But when i launch app i get System.NullReferenceException
error.