JuicyMike Posted May 9, 2012 Posted May 9, 2012 I do reference another class named Config, but that is not where the problem lies. the issue is when the network path is passed through "Filename" it adds more "\"'s Example txtdataPath.Text ="\\server\folder\file" If i were to put a linebreak over "Filename" it would read \\\\server\\folder\\file private void btnTest_Click(object sender, EventArgs e) { string Filename = txtdataPath.Text; string un = txtuserName.Text; string pw = txtPassword.Text; //Validation if (string.IsNullOrEmpty(Filename)) { MessageBox.Show("Please Load your Dictionary File"); } else if (!Filename.Contains("\\")) { MessageBox.Show("Please Enter UNC path"); goto Finish; } //Test cnnectin config Config = new config(); Config.testConnection(un, pw, Filename); Finish: ; } Has this ever happened to anyone else? i really dont see why this is happening. the wrong datapath means wrong connection string.. I'm totally new to C# ive been converted from VB Quote
JuicyMike Posted May 9, 2012 Author Posted May 9, 2012 Never mind i got it. For other newbies that convert from other languages the literal "\" is the escape key to bypass use the @ in the beginning of the string. The compiler will bypass it Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.