|
|
|
|
that is a nice link ...all code and steps are given...
|
|
|
|
|
|
|
I'm trying to create a ListBox on the fly without using any XAML code. I got it working - almost. What I have is an array of TextBoxes of 'Zone Descriptions'. I can put those into the ListBox as ListBoxItems, and it works great - no problem.
I want to add at the front of the TextBox a TextBlock or header that says 'Zone 1' or whatever the zone is along with the TextBox, which is user changeable. I have an array of TextBlocks (I probably could have had strings just as well). But, I can't (or don't know how to) adjust the ListBoxItem.Content to hold both the TextBlock and TextBox combo. LBI[i].Content = TBlkZoneDesc[i] + TBxZoneDesc[i] is what I want to do, but that syntax is not allowed. Doing either one separately works fine, but not both.
Do anyone have a suggestion on how to do that?
ListBox LBZoneDesc = new ListBox();
LBZoneDesc.Width = 300;
LBZoneDesc.Height = 240;
Grid.SetColumn(LBZoneDesc,0);
Grid.SetRow(LBZoneDesc,2);
ListBoxItem[] LBI = new ListBoxItem[64];
for (byte i = 0; i < 5; i++)
{
LBI[i] = new ListBoxItem();
LBI[i].Padding = new Thickness(2);
// LBI[i].Content = TBlkZoneDesc[i];
LBI[i].Content = TBxZoneDesc[i];
LBZoneDesc.Items.Add(LBI[i]);
}
C0Grid.Children.Add(LBZoneDesc);
|
|
|
|
|
Hello,
I have an issue in regular expression matching...
string x = "user = 'sa' password='eX65dere' server = 'localhost'";
Regex rx = new Regex("password=\'([a-zA-Z0-9]\\_+)\'");
var r = rx.Match(x);
if (r.Groups.Count > 0)
{
var g1 = r.Groups[0];
MessageBox.Show(g1.ToString());
}
while executing this, I have got the following error message. parsing "password='([a-zA-Z0-9]\_+)'" - Unrecognized escape sequence \_.
the following will work fine, when i try to add _ to the expression the exception occurs.
Regex rx = new Regex("password=\'([a-zA-Z0-9]+)\'");
Can anyone help me on this?
|
|
|
|
|
I have solved this by changing the expression as follows...
Regex rx = new Regex(@"password='([a-zA-Z0-9\\%^&_*]+)\'");
Regards
Sebastian
|
|
|
|
|
Why are you escaping the underscore character? it is a normal character as far as Regex is concerned, just like + and -
|
|
|
|
|
Snap!
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
Simple. Underscore is not a metacharacter, so it doesn't need escaping (preceding with backslash).
Cheers,
Peter
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
Got the idea, Thanks...
again i have another question... Here is my updated expression...
string x = "user = 'sa' password='e X65dere!@#$%^&*()' server = 'localhost'";
Regex rx = new Regex(@"password=\'([a-zA-Z0-9\\!@#$%^&*|() _'""*-+{}<>,.;/?:~`\[\]\\\\]+)\'");
var r = rx.Match(x);
if (r.Groups.Count > 0)
{
var g1 = r.Groups[0];
MessageBox.Show(g1.ToString());
}
In this case it will match for every small & large cap letters, numbers and special characters except = . If the password contains = the expression fails... can you please help?
modified 23-Mar-12 8:00am.
|
|
|
|
|
The reason is the quantifier + is greedy quantifier, that is it matches everything that matches the pattern up to the end of the input string. In your case it matches
password='e X65dere!@#$%^&*()' server = 'localhost'
when = is put in the pattern as every thing in between the first ' and last ' matches according to the pattern given when = included. To change this behaviour use the lazy quantifier that is +? instead of + alone.
|
|
|
|
|
great help....worked...thanks
|
|
|
|
|
Thank you
modified 25-Mar-12 2:57am.
|
|
|
|
|
Hey everybody,
I'm experiencing a pretty awful error on visual studio 2008
That error happens when I try to make a new WPF application, and I don't know why.
Here's the image for the error:click here
I hope someone can help me out!
Thank you!
EDIT: Sorry for posting it in the wrong section!
|
|
|
|
|
It seems the project was created by a Professional or Ultimate version of Visual Studio and you're using the Express version?
/ravi
|
|
|
|
|
I'm using the express edition on Visual Studio 2008.
And I'm using windows XP Professional SP2
|
|
|
|
|
AhmedOsama wrote: I'm using the express edition on Visual Studio 2008. Yes, I gathered that from your screenshot. Was the project also created in VS2008 Express?
/ravi
|
|
|
|
|
lol, that error happens when I try to create a new project, not to open an existing one. Well it happens also when I try to open an existing one!
|
|
|
|
|
Just to confirm, are you running VS2008 Express or VS2008 Express Web Developer Edition? The latter doesn't support creating WPF applications.
/ravi
|
|
|
|
|
lol, I'm using only VS2008 Express Edition, not the other one. And I used to create WPF applications, but I don't know what has happened.
|
|
|
|
|
Open visual studio command prompt and type in devenv /resetsettings. This will reset VS to factory settings.
Note however, this will reset all VS settings and you might lose all of them.
|
|
|
|
|
It showed me that this command doesn't exist.
Actually, I've searched the C: directory (System directory) for devenv, but found nothing.
Please help me!
|
|
|
|