|
overloaded Name wrote: of course ... we need double backslash
No you don't. Backslash doubling is meaningful only to the compiler itself, it is how one says the next backslash is to be taken literally; once a string literal is compiled, all escape sequences have been interpreted and no double backslashes remain (unless you had 4 backslashes, which could be useful in a UNC).
FWIW: Your code, corrected so it compiles, but totally useless, would be:
string path = "d:\\songs\\audio\\asd.mp3";
string modifiedName = path.Replace("\\", "\\\\");
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
modified on Thursday, March 3, 2011 8:06 AM
|
|
|
|
|
Hi Luc,
Im sure you know that , but the first line doesnt compile. Its an invalid string literal.
One have to use
strind path = @"d:\songs\audio\asd.mp3";
or
string path = "d:\\songs\\audio\\asd.mp3";
Greets
Matthias
|
|
|
|
|
My mistake, I copied and only fixed the second line. I'll fix it now. Thanks.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Hi,
In my application, am exporting the data from Grid to Excel file and save it in My Documents.
If the user dont have Excel installed in his machine, it has to redirect it to google spreadsheet to view the exported file..
Can any one tell me how to do it...
As of now, am displaying a message to the user if he dont have Excel installed in his machine to view the Exported Excel file, i want to replace this by redirecting it to Google spreadsheet to view the exported file, am using a code this code to display message to the user..
if (MessageBox.Show(
"Data Exported to File " + strFileName +
" at location MyDocuments. Do yo want to view the saved file?",
"Work Done",
MessageBoxButton.YesNo,
MessageBoxImage.Information) == MessageBoxResult.Yes)
{
Type officeType = Type.GetTypeFromProgID("Excel.Application");
if (officeType == null)
{
MessageBox.Show("Please Install MS Excel to view this file", "Liquidity Risk Management");
}
else
{
olx.visible=true;
}
}
|
|
|
|
|
First you must think about how to upload files to a Google Docs account and then how to redirect the user.
|
|
|
|
|
I'm trying to create certificates through programatically and created a batch file as below
cd c:\Program Files\Microsoft Visual Studio 9.0\VC
makecert -ss CBBC
Note:CBBC is the certificate name, I'm using Visual studio 2008
When I tried to execute this batch file through programatically, it displayed the below message in command window.
"'makecert' is not recognized as an internal or external command, operable program or batch file."
When I tried manually, its creating certificate successfully. Please let me know the solution.
|
|
|
|
|
Include the path to the MakeCert application. If it can't find the command, you'll get the error that you described. The easiest way is to enhance/copy the batchfile that's used for the "Visual Studio 2005 Command Prompt" - look under the Start menu, under the "Microsoft Visual Studio 2005" folder; it has a Tools-folder, and it should have a link to said batchfile. That should also contain the commands to set the correct search-paths, so that it includes the commands for Visual Studio in your command prompt.
I are Troll
|
|
|
|
|
oh I see, I thought he was using CD to goto the correct directory for makecert
mine is C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\makecert.exe (if that helps anyone)
Don't vote my posts down just because you don't understand them - if you lack the superior intelligence that I possess then simply walk away
|
|
|
|
|
musefan wrote: I thought he was using CD to goto the correct directory for makecert
Remembering to change the directory would be the easiest way to solve it
I are Troll
|
|
|
|
|
do you need to use START (or something like that) before the program name
cd c:\Program Files\Microsoft Visual Studio 9.0\VC
START makecert -ss CBBC
EDIT:
it seems the problem is more likely the location of the makecert file (which is not in the CD directory as I assumed was being done)
correct version may look something like...
cd "C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin"
makecert -ss CBBC
OR
cd c:\Program Files\Microsoft Visual Studio 9.0\VC
START /D"C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\" makecert.exe -ss CBBC
Don't vote my posts down just because you don't understand them - if you lack the superior intelligence that I possess then simply walk away
modified on Thursday, March 3, 2011 6:42 AM
|
|
|
|
|
cd "C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin"
makecert -ss CBBC
it worked. Thank you...
I found there is a default certificate(Joe's-Software-Emporium) in CBBC Folder. How can I delete this default one. Thank you in advance
modified on Thursday, March 3, 2011 7:12 AM
|
|
|
|
|
I am using below code from below link:
using System.Globalization;
using System.Text.RegularExpressions;
string strValue= "0932;093E;0926;0947;0928;";
Regex rgexp = new Regex(@"([0-9A-Fa-f]{4});");
string strResult= rgexp .Replace(strValue, match => ((char)Int32.Parse(match.Groups[1].Value, NumberStyles.HexNumber)).ToString());
Response.Write(strResult);
Source:http://www.dotnetspider.com/resources/39073-How-convert-hindi-using-unicode.aspx
But there is red line with match = "> (Here it is showing red line)"
I am going to convert a Unicode String to Hindi (Indian Language). I am using VS 2005 Prof Edition.
Thanks.
|
|
|
|
|
I think your syntax may be incorrect (looks like LINQ), see here[^] for a sample of the Replace() method.
I must get a clever new signature for 2011.
|
|
|
|
|
and what is the error message that it shows..?
|
|
|
|
|
Thanks for your reply. Here it is the code:
<br />
private void button1_Click(object sender, EventArgs e)<br />
{<br />
string strValue= "0932;093E;0926;0947;0928;";<br />
Regex rgexp = new Regex(@"([0-9A-Fa-f]{4});");<br />
string strResult= rgexp.Replace(strValue, match => ((char)Int32.Parse(match.Groups[1].Value, NumberStyles.HexNumber)).ToString());<br />
textBox1.Text=strResult;<br />
}<br />
And the error :
Invalid expression term '>'
Even i am not able to resolve the issue from link given by first user please.
Thank you.
|
|
|
|
|
If I copy that code, then it works fine for me.
If you are getting an error around the => part (known as lambda expression[^]) then perhaps you are not using the correct version of .Net required to do this which is .Net 3.5 or above (I think)
EDIT
Change target framework[^] (VS 2008 but I am sure you will work it out for 2005)
...if version 3.5 or higher is not available then you will most likely need to install it first
CORRECTION
...actually you will need to get a copy of VS 2008 or VS 2010 if you want to use .Net 3.5 or higher
Don't vote my posts down just because you don't understand them - if you lack the superior intelligence that I possess then simply walk away
modified on Thursday, March 3, 2011 5:53 AM
|
|
|
|
|
VS2005 only supports the 2.0 framework. He'd have to compile by hand if he's going to use 3.0, or download VS2k8 Express
I are Troll
|
|
|
|
|
...you may have your knowledge, but at least I have my youth!
I see[^], exactly for the same reason why the OP is having the problem
Don't vote my posts down just because you don't understand them - if you lack the superior intelligence that I possess then simply walk away
|
|
|
|
|
Girish481 wrote: Unicode String to Hindi
Could you explain that? AFAIK, Unicode supports all characters. You're going to save it as ANSI with a Hindi-codepage?
What are you trying to achieve?
Girish481 wrote: I am using VS 2005 Prof Edition.
Would be .NET 2.0, and that doesn't support Lambda-statements. You'll have to convert it to a real method, or upgrade to a newer version of .NET.
I are Troll
|
|
|
|
|
If it is due to older framework version; then i will test the code on another machine and will post the output/error (if any).
Thank you very much for your replies.
|
|
|
|
|
As Eddy has said, you need to use a newer version of VS (i.e. 2008 or 2010) in order for the compiler to accept the lambda expressions. It is not just the installed version that is required
Don't vote my posts down just because you don't understand them - if you lack the superior intelligence that I possess then simply walk away
|
|
|
|
|
>What are you trying to achieve?
Actually i have got couple of files named like file1.txt, file2.txt etc... and these files are having unicode data too. I have to store these files data into databases like Oracle, SQL Server. So, i was in search to first convert a unicode string to convert it into editable text; i.e. something like :
Unicode String is "This is a unicode string" and i wish :
New String is : "Something text after conversion"; and then if i select hindi (an Indian Language) font for new string; it will show me the original string as it was in Unicode.
Now, here i do'nt know how do i know the complete steps to convert these files into that format; so that i can store those data into databases.
Thank you.
|
|
|
|
|
Girish481 wrote: I have to store these files data into databases like Oracle, SQL Server. So, i was in search to first convert a unicode string to convert it into editable text; i.e. something like :
Every string in .NET is in Unicode, it's the default nowadays. Meaning that you only need to read the text and pass it on to your database. Do make sure that your database also stores them in that format.
Girish481 wrote: Unicode String is "This is a unicode string" and i wish : New String is : "Something text after conversion";
That doesn't make sense. Unicode contains Hindi-characters - what would you want to convert them into?
Girish481 wrote: and then if i select hindi (an Indian Language) font for new string; it will show me the original string as it was in Unicode.
Both show the original string in the same encoding, only with different fonts. Some fonts are designed for use with ANSI and a specfic codepage, others were created for unicode[^]. Your string in Hindi should look allright when displayed as unicode in one of those fonts.
I are Troll
|
|
|
|
|
I am sorry for being late reply.
Probably i am not able to explain my need. See, whatever you have said, that is fine that if i says dim x as string="Hindi Words"; they are visible in the dotnet; but i want to convert them into "editable text", wish to apply some sort of font displays like bold, italic, color change etc. so, that i can say select * from mytable where name like '%Some Search String based upon Hindi words..%'. Here issue is that they are visible in IDE and Textboxes; but how do i give select criteria in the textbox so that database can see the query as mentioned above please.
Please let me know :
1.How do i convert Unicode Text to Edibable Text?
2.It would be more helpful if you please show me some code in action.
@ the moment; i am reading below link... but Ouch...it is also returning error....
Please scorll down and read the reply posted by Atul Bari...
http://nishantpant.wordpress.com/2007/01/04/how-to-convertdisplay-a-unicode-string-in-vbnet/
and the SQL Server Error is :
Msg 102, Level 15, State 1, Procedure Hex, Line 11
Incorrect syntax near '‘'.
Msg 102, Level 15, State 1, Procedure Hex, Line 20
Incorrect syntax near '‘'.
Msg 102, Level 15, State 1, Procedure Hex, Line 29
Incorrect syntax near '‘'.
Msg 102, Level 15, State 1, Procedure Hex, Line 38
Incorrect syntax near '‘'.
Msg 102, Level 15, State 1, Procedure Hex, Line 52
Incorrect syntax near 'end'.
Thank you very much for your continue support.
|
|
|
|
|
Girish481 wrote: Probably i am not able to explain my need
No worries; text-encoding is a though subject and I'm not very good at explaining either.
Girish481 wrote: . See, whatever you have said, that is fine that if i says dim x as string="Hindi Words"; they are visible in the dotnet;
Strings in .NET are in Unicode, in UTF8 to be precise. (UTF7, 8, 16 and 32 are all Unicode-formats), but Windows was around long before .NET - not everything is prepared for multibyte-characters. As a test, you can create a new project in Visual Studio and replace the code from Form1 with this code;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
public partial class Form1 : Form
{
const String ओम् = "ॐ (that's Ohm)";
TextBox myTextBox;
RichTextBox myRichBox;
public Form1()
{
InitializeComponent();
myTextBox = new TextBox();
myTextBox.Dock = DockStyle.Top;
myTextBox.Text = ओम्;
this.Controls.Add(myTextBox);
myRichBox = new RichTextBox();
myRichBox.Dock = DockStyle.Top;
myRichBox.Text = ओम्;
this.Controls.Add(myRichBox);
String cs = "Server=.;Database=Northwind;Trusted_Connection=True;";
using (SqlConnection con = new SqlConnection(cs))
using (SqlCommand cmd = con.CreateCommand())
{
cmd.CommandText = "UPDATE Customers SET CompanyName = @what WHERE ContactName = @ContactName";
cmd.Parameters.AddWithValue("ContactName", "Antonio Moreno");
cmd.Parameters.AddWithValue("what", ओम्);
con.Open();
cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
cmd.CommandText = "SELECT CompanyName + '.' + ContactName FROM Customers WHERE CompanyName LIKE @bla";
cmd.Parameters.AddWithValue("bla", "%ॐ%");
string result = cmd.ExecuteScalar().ToString();
myTextBox.Text = result;
myRichBox.Text = result;
}
}
} Visual Studio should complain that you're using non-standard characters and it should propose to save it in a "universal" format - that's going to be Unicode again. If you have the Nortwind-database installed than you can execute this code as is, otherwise you'll have to change the table-names.
If all is well, it'd update a record in that database and search that record again - displaying the result in both textboxes.
Girish481 wrote: 1.How do i convert Unicode Text to Edibable Text?
As the example shows, Unicode is editable. Not every control understands unicode, which might be the reason why your seeing blocks (or question marks) in certain controls. It should also be noted that most databases expect ASCII/ANSI for text-fields, having special fields for multibyte-character sets. In Sql Server, that'd be the datatypes that are prefixed with an 'N', like NVARCHAR .
Girish481 wrote: and the SQL Server Error is :
Are you concatenating the parameter to the command (like "SELECT " + textbox1.Text) or are you using a SqlParameter to fill in the parameters of the query?
Hope this gets you going in the right direction
I are Troll
|
|
|
|
|