|
I get a string in the following format from an Html file after calling a GetAttribute method:
file:///C:/Documents%20and%20Settings/azabobonin/My%20Documents/My%20Pictures/Einstein.jpg
How can I format that string to look normally:
C:\Documents and Settings\azabobonin\My Documents\My Pictures\Einstein.jpg
Is there a way of getting the string the way it is writen in the Html file, and not the way it returns from GetAttribute method?
Thank you
|
|
|
|
|
try the Replace function.
string test = "file:///C:/Documents%20and%20Settings/azabobonin/My%20Documents/My%20Pictures/Einstein.jpg";<br />
test = test.Replace("%20", " ");
hope this helps.
V.
If I don't see you in this world, I'll see you in the next one... And don't be late. (Jimi Hendrix)
|
|
|
|
|
Use HttpUtility.UrlDecode and then replace the / with \.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
I found the solution.
<br />
Uri uri = new Uri(element.GetAttribute("src"));<br />
string filePath = HttpUtility.UrlDecode(uri.AbsolutePath);<br />
Thank you.
|
|
|
|
|
I wanted to have milliseconds component being added to my DateTime object. It only returns dateTime till seconds. How can i get milliseconds.
DateTime currentDate = DateTime.Now // this statement returns time upto seconds
How can i get milliseconds?????
Thanks in advance
Praveen Raghuvanshi
Software Engineer,
|
|
|
|
|
Try:
DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss:ff");
hope this helps
V.
If I don't see you in this world, I'll see you in the next one... And don't be late. (Jimi Hendrix)
|
|
|
|
|
V. wrote: DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss:ff");
That only goes to centiseconds.
|
|
|
|
|
you can go up until fraction 7 ( so "fffffff")
|
|
|
|
|
Thanks a lot.....
Praveen Raghuvanshi
Software Engineer
|
|
|
|
|
praveen raghuvanshi wrote: I wanted to have milliseconds component being added to my DateTime object. It only returns dateTime till seconds. How can i get milliseconds.
DateTime currentDate = DateTime.Now // this statement returns time upto seconds
How can i get milliseconds?????
The milliseconds component is in there. Is your question about storing to millisecond accuracy, or getting the current time to millisecond accuracy?
A DateTime object can store to milliseconds. e.g.
Console.WriteLine("Now: {0}", DateTime.Now.ToString("HH:mm:ss.fff");
|
|
|
|
|
Thanks for ur effort, i got my answer
Praveen Raghuvanshi
Software Engineer,
Wins Infotek Pvt. LTd.
Technopark, Trivandrum
India.
|
|
|
|
|
Hi,
Iam trying to verify a user account present in the local computer using DirectoryEntry.
The code is as given below:
public bool TestUserLoginInComputer(string userNamePath, string userPassword)
{
try
{
DirectoryEntry myUser = new DirectoryEntry(string.Format("WinNT://" + _machineName + "/" + userNamePath + ", user"),userNamePath, userPassword);
if (myUser != null)
{
mname = admin.Name;
mypath = admin.Path;
return true;
}
else
{ return false; }
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
Iam getting an exception saying "Logon failure: unknown user name or bad password.". Even though I hav given correct username and password. I hav checked with several accounts, but same problem.
Please sumone cud help me out .
Thanks in advance.
Martin
|
|
|
|
|
Hi,
I get this error: ArgumentOutOfRangeException
In this line:
this.Invoke(new DelA(delegateA), new object[] { s });
This is the environment of this code:
void delegateA(string s)
{
if (this.InvokeRequired)
{
this.Invoke(new DelA(delegateA), new object[] { response });
}
}
I've tried a few things to fix this, but im running out of suggestions.
Any suggestions anyone?
Thanks in advance!
|
|
|
|
|
Hello,
Is "response" a string?
Does youre DelA have an string parameter too?
Martin
|
|
|
|
|
Hi,
Yes on both questions.
|
|
|
|
|
Hello,
Could you post the full code of youre method and the delegate?
Martin
|
|
|
|
|
Hi,
I get this error in run time, by the way.
Here is the code:
void delegateA(string s)
{
if (this.InvokeRequired)
{
this.Invoke(new DelA(delegateA), new object[] { s });
}
else
{
if (this.itemscounter < this.totalitems)
{
this.itemscounter++;
}
}
}
This is the code where the the delegate listens to:
if (this.DelA != null)
{
this.DelA(this.bufferofserialport);
}
When i change the "< this.totalitems" to "< this.totalitems - 1", its not showing up the error.
But than its not completing till the end of the items in my listbox.
Thanks in advance!
|
|
|
|
|
Hello,
Are you using "itemscounter" for an access of an array somewhere?
for example:
xxx[itemscounter]
or
for(int i=0;i<=itemscounter;i++){ xxx[i]....)
Martin
|
|
|
|
|
Hi,
yes an ArrayList.
I filled the array with items with the for statement.
And using it now like xxx[itemscounter].
And in the if statement i go to the next item in the array.
|
|
|
|
|
Hello,
So it looks like the problem is here.
I guess if you depug the for statement you maybe find out that you whant to access a index which is out of range.
Maybe you just have to change some code from:
for(int x=0;x<=y;x++)
to:
for(int x=0;x<y;x++)
Hope that helps!
All the best,
Martin
|
|
|
|
|
I'm trying to find good example for DataGrid (could be with DataSet example) with local database... I do not want example with SQLserver (which I have seen in many 'net sites), just local database.
Thanks!
|
|
|
|
|
What type of database is your local database?
|
|
|
|
|
I'm looking into simple 2 columns (name of variable, and Interpreted Data)... the interpreted data would be the translation of the raw hex data from a raw data line on file. Since that there are many lines (could be up to 3000 lines in all), wonder if I could set up the dataset to work with datagrid so i can view the data page by page by clicking "next" button?
Hope that clears up.
|
|
|
|
|
I am beginning to understand what your datasource is / looks like. Could you please send me an example of a row of data or two rows of data and I am sure I can assist you.
|
|
|
|
|
Ok.. to clarify what the datasource looks like... (both are string value).
I'm not sure how to set up the dataset so i can look on the next set of data.
from the first row of raw data would have:
Name Interpreted_Value
Color_Used Cyan
Install_Date 12/21/99
Error_Code 848-323
Next row from raw data:
Name Interpreted_Value
Color_Used Magenta
Install_Date 3/21/93
Error_Code 239-772
Next row from raw data:
Name Interpreted_Value
Color_Used Magenta
Install_Date 1/2/03
Error_Code None
|
|
|
|