|
The string x will contain one single character, the quotation mark.
If you have any trouble using it, you have to be using it the wrong way. How do you use it?
---
b { font-weight: normal; }
|
|
|
|
|
try this
char hi= '"';
string say = "hello my name is "+ hi+ "james" + hi;
I hope this helps u
|
|
|
|
|
Hi, I am developing a voice chat application in DirectSound, when I play the voice on the second pc, my voice seem to me a robot voice,I think I play digital voice on the other end, can anyone solve this problem, I will be thankful to u.i am using stream socket to send the captured voice bytes.
|
|
|
|
|
Hi...
how can i play the Audio files in .NET using C# ?
I can select the file to be played but , how can i play it ?
do i have to download any sort of Audio player compatible with .NET ?
Kamran
|
|
|
|
|
You can try using the Windows Media Player control. This[^] is a good place to start from. However, you can always google it[^].
Regards,
Polis
Can you practice what you teach?
|
|
|
|
|
Hi,
This is srinivas and I have got a rquirement of sending SMS from PC to all Mobile Phones from all over the world. If you have any coding or if you know any websites providing this information plese inform with the website.
Currently the program which we have written is sending SMS for only numbers starting 984..... here we haven't given any query. So please verify it and respond as early as possible.
Thanking you I will be waiting for ur reply.
warmregards
Srinivas
Globalways Solutions.
M.SrinivasRao
|
|
|
|
|
Hi
I use a COM object which needs that I set my Threading-Model to Multi-Threaded-Apartment (MTAThread). If I do not set it to MTAThread I get System.InteropServices.COMException when I call COM-Functions.
If I set it to MTAThread I get a 'System.InvalidOperationException:DragDrop registration failed' exception when opening a Windows-Form element with AllowDrop set to true.
Is it not possible to enable DragDrop in a Multi-Threaded-Apartment?
Thanks
Martin
|
|
|
|
|
I want to convert a string to its binary equivelancy. How might I go about doing this? This is what I have so far, but it doesnt work.
if(textBox1.Text.ToString() != "")<br />
{<br />
int temp2;<br />
string temp = textBox1.Text.ToString();<br />
temp2 = Convert.ToInt32(temp,2);<br />
textBox2.Text = temp2.ToString();<br />
}<br />
else<br />
{<br />
textBox2.Text = "Please enter a String";<br />
}
-- modified at 2:44 Wednesday 14th December, 2005
|
|
|
|
|
I don;t think that this is actually what you are trying to do but your code is designed to convert a binary number into a base10 Integer
Is the text in the textbox1 actually a valid binary string of mumbers? - e.g., "1000111100010".
So if the value was as above you are trying to produce the the Int32 equiv of that Base 2 Binary Number: e.g.:
<br />
int temp2 = 0;<br />
string temp ="1000111100010";<br />
temp2 = Convert.ToInt32(temp,2);<br />
MessageBox.Show(temp2.ToString ());<br />
Produces the output
4578 which is the integer equivilant of the binary number 1000111100010
Is that waht you're trying to do?
|
|
|
|
|
I want it so that the user enters any String like "Hello World" into textBox1.
Then it converts the string to its binary form, 100101010010110 (or whatever it may be)
Basically I want it the exact opposite way that Rowan just described.
|
|
|
|
|
Well, that is possible - can I ask why you want to do this?
If it is unicode then every character represents atleast 8 digits in binary. So if the text is Hello World you will have a string 8 * Length("Hello Word") = 80 Characters long.
Each character can be represented as a number between 0 and 255. So what you have to do is convert each character of the string to its binary number and then append it to another string.
Without actually writing the code I guess it would go something like this:
<br />
string temp1 = "Hello World";<br />
string output = "";<br />
foreach (char x in temp1)<br />
output += ConvertToBinary(x);<br />
I couldn't find a Convert to Binary Routine so you may have to write one yourself.
Good luck.
-Rowan
|
|
|
|
|
In addition to Rowan's reply, you don't need to do
string temp = textBox1.Text.ToString();
Just textBox1.Text will do.
Cheers,
Vikram. "When I read in books about a "base class", I figured this was the class that was at the bottom of the inheritence tree. It's the "base", right? Like the base of a pyramid." - Marc Clifton.
|
|
|
|
|
Hi!
Do you want to save the data in a byte array? You have to take care what character you are using, if it is not european and american characters, you should keep it as unicode. Otherwise, don't waste the space and convert it to binary ascii. Hre are tow examples:
<br />
Byte[] lbASCII = System.Text.Encoding.ASCII.GetBytes(textBox1.Text);<br />
<br />
Byte[] lbUnicode = System.Text.Encoding.Unicode.GetBytes(textBox1.Text);<br />
I hope this is what you want!
To convert it back to an unicode string, you can use this:
<br />
string lsString1 = System.Text.Encoding.ASCII.GetString(lbASCII);<br />
<br />
string lsString2 = System.Text.Encoding.Unicode.GetString(lbUnicode);<br />
Marcel Erz
-- modified at 3:44 Wednesday 14th December, 2005
|
|
|
|
|
Hi, I want to open an Excel file, which is located on the server side, on the client machine, but my code open the excel workbook on the server machine. I want to start up the excel application on the client and open the workbook on the screen.
How can I manage this problem? Thank you.
-- modified at 3:00 Wednesday 14th December, 2005
|
|
|
|
|
Hi Friends!
I want to declare a variable that i can see its value all over the project, Like forms and classes. It means i want set its value in Form1 and see that value in Form2 and disposing some forms cant keel that Variable. In Visual Basic i were using Madule, But in C# i dont know what should i do.
Please Help Me
Thank You.
|
|
|
|
|
Given I have been programming C# for 5 days I am not exactly sure if this is correct, but it works for me:
<br />
namespace theGlobals<br />
{<br />
public class myGlobals<br />
{<br />
static public string myGlobal1;<br />
static public string myGlobal2;<br />
}<br />
}<br />
Whenever you want to get your global you just reference:
myGlobals.myGlobal1
The static values remain static across any and all coppies of this class that you make. Infact I never even make a new class - e.g., I never use:
<br />
myGlobals blah = new(myGlobals());<br />
anywhere in my code.
Good Luck.
-Rowan
|
|
|
|
|
HI!
This is correct! You just need to define variables as static in any class, then you can access the variables even without creating an instance. So, this will work well:
<br />
myGlobals.myGlobal1 = "test";<br />
To create an instance just for static variables make no sense.
Another positive thing about static variables:
If you create a class, that manage like for example connections, and you want that all connections have the same timeout-value, you just need to change the variable in one of the instances or directly throu the static class property and it will be changed for all instances. This make it quite easy to have global variables for configuration of instances and even have the configuration value in the same class.
YOu can use the static keyword for methods too. This make it easier to access methods without even creating an instance.
Marcel Erz
|
|
|
|
|
Hello Dear Marcel Erz
I tried to solve my problem with your advices, But i couldn't.
I defined many static variables, but i can't use them, program can't initialize them. I'm so sorry, Can you write me some example code about this. For example i have 2 form. i define variable in form one as :
Public Class Form1()
{
static string globalVar;
globalVar = "500" ;
..
}
This Code :
Public Class Form2()<br />
{<br />
textBox1.Text = globalVar ;
..<br />
}
Or This Code :
Public Class Form2()<br />
{<br />
Form1 myForm1 = new Form1();<br />
textBox1.Text = myForm1.globalVar ;
..<br />
}
Thank you for your help.
|
|
|
|
|
Hi!
Sure, no problem! Here is an example:
<br />
Public Class Form1() : System.Windows.Forms.Form<br />
{<br />
public static string globalVar = "500";<br />
..<br />
}<br />
Later on in the other Form...:
<br />
Public Class Form2() : System.Windows.Forms.Form<br />
{<br />
private void button1_Click(object sender, System.EventArgs e)<br />
{<br />
MessageBox.Show(Form1.globalVar);<br />
}<br />
}<br />
Marcel Erz
|
|
|
|
|
Dear Friend Marcel Erz
Hello
I'm so thank you frm your help.
Last day i leave my workplace and can't to check your ladt guide, But this morning me and I worked about that and it worked.
I'm working .Net Database under SqlServer, If i can help you about this, Please Just Mail me (freshonline2003@yahoo.com).
Again Very Well Thank You.
|
|
|
|
|
I was stuck in this global variable stuff fro days. But the solution sujjested by Rowan is awesome. thanks a lot for posting the solution
|
|
|
|
|
You cannot create global variables in C#. Instead, create a static variable in your main form class.
Cheers,
Vikram. "When I read in books about a "base class", I figured this was the class that was at the bottom of the inheritence tree. It's the "base", right? Like the base of a pyramid." - Marc Clifton.
|
|
|
|
|
Hi everyone,
i was just searching the site for creating customized window in C#, but couldn't find any. Suppose i have a graphical image and want it to be my window.
Can anyone tell me where and how to start?
Or, if i can find any article related to it.
Any help will be appreciated.
Much thanks.
*** Who said nothing is impossible? I have been doing it for a long time ***
|
|
|
|
|
HI!
You can create a window and change the property "FormBorderStyle" to "None" and load the image file to the "BackgroundImage"-property. Then, for the next formulars you want to use it as a forumlar, you just need to inherit it. Just click right on the project-explorer (sorry, have the german version; dunno if it is correct translation for the english version) on the project and select "Add..." and "Add inherited formular". There you will be able to select one of your windows and the window will be inherited from the one you selected. If you make changes to the original formular, you need to recompile it before you see changes to the inherited formulars.
Marcel Erz
|
|
|
|
|
Hi Marcel,
Thanks for the reply.
That would be surely be a lot of help
But, i am not able to understand the meaning of "formular". Does it mean the window form that you are creating (i.e. the template given, on which you drag-drop the controls, when a new windows application is created). Well, i just searched google for that word and found that "formular" means "form".Quite near, i think. I hope i got it correct.
I mean, if you could tell me where exactly you get it, i'll be able to understand it better.
But, thanks again. I can start exploring from here.
Thanks a lot.
*** Who said nothing is impossible? I have been doing it for a long time ***
|
|
|
|