object reference not set to an instance of the object
-
I am trying to pull data from a DB and have it prefill a form when the form is pulled up. Here is a little snippet of code that I am using. I am getting a handling error (in subject line) public static string[] FormArgs; public static DESClient.DESClientConnection conn; private DESClient.DESApplicant applicant; private string primedln = String.Empty; int x = 0; foreach(string arg in FormArgs) {switch( x ) {case 4: primedln = arg; break;} x += 1; } applicant = new DESClient.DESApplicant(conn); applicant.setAppID(Convert.ToInt32 (primedln) ); lbName.Text = applicant.getLname()+", "+ applicant.getFname()+" "+ applicant.getMname()+"."; lbDLN.Text = applicant.getAppId() +"/"+ address.getState().ToUpper(); static void Main(string[] args) { Form1.FormArgs = args; Application.Run(new Form1()); }
-
I am trying to pull data from a DB and have it prefill a form when the form is pulled up. Here is a little snippet of code that I am using. I am getting a handling error (in subject line) public static string[] FormArgs; public static DESClient.DESClientConnection conn; private DESClient.DESApplicant applicant; private string primedln = String.Empty; int x = 0; foreach(string arg in FormArgs) {switch( x ) {case 4: primedln = arg; break;} x += 1; } applicant = new DESClient.DESApplicant(conn); applicant.setAppID(Convert.ToInt32 (primedln) ); lbName.Text = applicant.getLname()+", "+ applicant.getFname()+" "+ applicant.getMname()+"."; lbDLN.Text = applicant.getAppId() +"/"+ address.getState().ToUpper(); static void Main(string[] args) { Form1.FormArgs = args; Application.Run(new Form1()); }
Which line is the error occurring in? I don't see a "subject line".
Tech, life, family, faith: Give me a visit. I'm currently blogging about: And in this corner, the Party of Allah The apostle Paul, modernly speaking: Epistles of Paul Judah Himango
-
I am trying to pull data from a DB and have it prefill a form when the form is pulled up. Here is a little snippet of code that I am using. I am getting a handling error (in subject line) public static string[] FormArgs; public static DESClient.DESClientConnection conn; private DESClient.DESApplicant applicant; private string primedln = String.Empty; int x = 0; foreach(string arg in FormArgs) {switch( x ) {case 4: primedln = arg; break;} x += 1; } applicant = new DESClient.DESApplicant(conn); applicant.setAppID(Convert.ToInt32 (primedln) ); lbName.Text = applicant.getLname()+", "+ applicant.getFname()+" "+ applicant.getMname()+"."; lbDLN.Text = applicant.getAppId() +"/"+ address.getState().ToUpper(); static void Main(string[] args) { Form1.FormArgs = args; Application.Run(new Form1()); }
TWatson47 wrote:
foreach(string arg in FormArgs) {switch( x ) {case 4: primedln = arg; break;} x += 1; }
Why not just grab the fifth item by index ? You need to step into this code, and work out which line is causing the error.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog
-
Which line is the error occurring in? I don't see a "subject line".
Tech, life, family, faith: Give me a visit. I'm currently blogging about: And in this corner, the Party of Allah The apostle Paul, modernly speaking: Epistles of Paul Judah Himango