|
Not automatically, you have to cast it.
A char in C# is a unicode character, while a char in C++ is actually not a character at all, but a byte.
---
Year happy = new Year(2007);
|
|
|
|
|
comboBox.DataSource = {'a','b','c','d','e','f','g','h','i','j','k' ... 'z'};
Just being funny. But itll work.
File Not Found
|
|
|
|
|
Here's another funny one.
public static class Alphabet {
public static IEnumerator Lower() {
for (char i = 'a'; i <= 'z'; i++) yield return i;
}
public static IEnumerator Upper() {
for (char i = 'A'; i <= 'Z'; i++) yield return i;
}
}
foreach (char i in Alphabet.Lower()) comboBox1.Items.Add(i);
---
Year happy = new Year(2007);
|
|
|
|
|
thats what I wrote the first time. But I created an interface first then I deleted the entire post because I was afraid someone would think I was serious.
File Not Found
|
|
|
|
|
Can someone give me an example pattern that matches:
$1.25
I can't seem to figure out how to match a literal "$" as it's not a valid escape character...
Thanks!
|
|
|
|
|
|
The $ character has a special meaning in regular expression (matching the end of the string). Use \$ to match a literal $.
---
Year happy = new Year(2007);
|
|
|
|
|
Nitron wrote: match a literal "$" as it's not a valid escape character...
As the other responses suggest, you should be able to escape the $. An alternative is to put it like this: [$] instead of escaping it.
|
|
|
|
|
You have to distinguish between Regex escape characters and C# escape characters.
If you escape a character for a Regex, you have to prefix it with a \. To write a \ in C#, you'll have to add another \.
So you'll have to use "\\$" or @"\$" in C#
|
|
|
|
|
Daniel Grunwald wrote: So you'll have to use "\\$" or @"\$" in C#
ahh... that makes sense. I was getting an error with \$, saying it wasnt an escape char, but \\$ might work... I'll try it tomorrow, thanks!
|
|
|
|
|
That [\\$] was it! Thanks, I would have never thought of that.
|
|
|
|
|
You may be able to just use Decimal.Parse if all you have is a money string.
File Not Found
|
|
|
|
|
hi People
I want to do this :
In the toolStrip i have one button and if i click that button textbox and butoon2 appear in toolStrip .Then if i click button 2 textbox disappear..
thx
nemanja
|
|
|
|
|
Trick question?
private void toolStripButton1_Click(object sender, EventArgs e)
{
toolStripButton2.Visible = true;
toolStripTextBox1.Visible = true;
}
private void toolStripButton2_Click(object sender, EventArgs e)
{
toolStripButton2.Visible = false;
toolStripTextBox1.Visible = false;
}
|
|
|
|
|
Hi people
Can you tell me how to find a word in rich text box ?
thx
nemanja
|
|
|
|
|
|
|
I have a program that the user double clicks and image and it shows in an image viewer (my own creation). However after closing the image viewer I can no longer delete the image from the file system. It says the File is in use. I have tried Disposing and Garbage Collecting, even Thread.Sleep to wait, but to no avail. How can I get the image viewer to relase the file even though it is long since disposed of?
Actually I think it might be a waiting issue since I got it to work in Debug mode but it continues to throw the error in Release mode.
Thanks for any ideas.
Brent
|
|
|
|
|
I'd check that sure AppName.vshost.exe isn't still running in Task Manager.
|
|
|
|
|
try a filestream. Something like this:
oFileStream = ne FileStream(FilePath, FileMode.Open);
oImage1 = oImage.FromStream(oFileStream);
oFileStream.Close();
oFileStream = null;
|
|
|
|
|
This seems to have fixed it. I was doing Image.FromFile(filename) which appears to lock filename as long as the image is around somewhere.
Thanks
Brent
|
|
|
|
|
Yes, this is a known issue. I tend to wrap image loading into a class ( which I need to do often as I am also reading non supported formats ) and I will read the image, copy it to a new image, and Dispose of the one I loaded, to get around this issue.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
better yet:
oFileStream = new FileStream(FilePath, FileMode.Open, FileAccess.Read);
Luc Pattyn
|
|
|
|
|
Hi,
I added a web reference and I wanted to dynamically get the link. So I thought to store it in the app.config as shown below. When I tried to read it from the below shown C# code it returns a null value.
app.config
<?xml version="1.0" encoding="utf-8" ?>
<appSettings>
<add key ="ABC" value ="http://localhost:9080/abc/services/abcWs"/>
</appSettings>
C# code
string WsUrl = ConfigurationManager.AppSettings["ABC"].ToString();
Does anybody know how to fix it?
Any help would be great!
Rgds,
Sampathg
|
|
|
|
|
I think that if you are writing a Web Services you need a Web.config not App.Config. Try to rename the file to Web.config
Davide
|
|
|
|