Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Posted

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...