|
Thanks Lisan
I'll get some good books but until then this works.
int left = 0;
int space = 1; //pix
int nbButtons = 5;
for (int i = 0; i < nbButtons; i++)
{
GlassButton gb = new GlassButton();
gb.Name = i.ToString();
gb.Text = i.ToString();
gb.Left = left;
gb.Location = new Point(20 + (i*5) , 10 + (i *5) );
this.Controls.Add(gb); //gb is a user control
left += gb.Left + gb.Width + space;
}
Thanks again
|
|
|
|
|
Hi.
I have a text input like this:
a: a-related text
b: b-related text
c: c-related text
d: d-related text
e: e-related text
f: f-related text
and a expression like this:
(a\:\s*)(?<a>.*)(\r\n)(b\:\s*)(?.*)(\r\n)(c\:\s*)(?<c>.*)(\r\n)(d\:\s*)(?<d>.*)(\r\n)(e\:\s*)(?<e>.*)(\r\n)(f\:\s*)(?<f>.*)(\r\n)
</f></e></d></c></a>
So far so good.
The problem is that I never know how many of the lines a-f which is present.
The text might look like this:
a: a-related text
c: c-related text
f: f-related text
or:
a: a-related text
b: b-related text
some strange text
f: f-related text
Any suggestion on how to write my expression?
Kjetil
|
|
|
|
|
|
Don't write a pattern for matching each separate line, write a pattern that matches any of the lines that you want:
(?:^|\r\n)([a-f]):\s*(.+?)(?:$|\r\n)
This should give you a match for each line, containing the a-f character and the related text as captures.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Beautiful expression.
But how do I name my groups?
Kjetil
|
|
|
|
|
Without naming the groups, you can access them by index.
You can name them like this:
(?:^|\r\n)(?<section>[a-f]):\s*(?<description>.+?)(?:$|\r\n)
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hi.
I really appreciate your help, but I still need some help.
RegExp is not my strongest side
I need to rephrase my question.
My text input is more like:
(I'm not allowed to use actual data from my project)
Breakfast: Sliced Bread
Lunch: At McDonald's
Dinner: Chicken
Supper: Mexican
and my task is to isolate what a person ate and save that info in my database.
Different person might have different ways to report their meals. Each person has a consistent way though. There are ~150 persons and they all skip meals from time to time.
Can you still help me ?
Kjetil
|
|
|
|
|
Instead of ([a-f]) in the pattern to match a single character, use (Breakfast|Lunch|Dinner|Supper) to match the strings.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hi.
It still does not work.
New problem:
The user input is like this
Breakfast: Sliced Bread
Lunch: At McDonald's
(had some coffee and snack)
Dinner: Chicken
Supper: Mexican
and my match.Groups[0].Value is
Breakfast: Sliced Bread
Lunch: At McDonald's
instead of
Breakfast: Sliced Bread
Lunch: At McDonald's
Dinner: Chicken
Supper: Mexican
Why?
This is starting to be embarrassing
Kjetil
|
|
|
|
|
No, that is not correct. If you check your result again, you will see that you are getting the breakfast and the dinner. That is because the pattern is consuming the line break before and after each match, so the next line won't match.
Change the part of the pattern that matches the end of the line or end of the string from (?:$|\r\n) to (?=$|\r\n) to make a zero-width positive lookahead.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hello Experts:
I want to open a Project developed in VS 2008 with 2.0 Framework. How can I open this complete project in C sharp Express Edition 2005. I can only be able to open .cs extension file but not the complete project.
While I am trying to open .csproj file I receive the following error message.
Unable to read the project file xyz.csproj.
thanks
|
|
|
|
|
In the .SLN file:
It looks like this for VS 2008:
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Change it to:
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Now you can load the solution. I have does this in the past and it works without issues.
|
|
|
|
|
Dear Expert:
I have tried your method but it does not work so finally I have created a new project in Express Addition and add .cs files into it and it works fine.
thanks for your quick responcce...HIghly appreciated.
|
|
|
|
|
Unless you really dig into the text behind the solution (and project) file, you will not be able to change a VS2008 solution to VS2005. You did exactly what should have been done: include the .NET 2.0 compatible projects into a new VS2005 solution.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my Blog
|
|
|
|
|
Hello all.
I want to generate a tiny preview image from a website by C#.
Do you have any suggestions ?
Thank you
modified on Wednesday, August 27, 2008 7:58 AM
|
|
|
|
|
|
Wow, nice response.
Thank you
|
|
|
|
|
There is an excellent WebBrowser wrapper control done in C# that gives you much greater control over the web browser--one such feature is the ability to generate a thumbnail for the current page:
Google Group[^]
CodeProject article (older)[^]
“Time and space can be a bitch.”
–Gushie, Quantum Leap
{o,o}.oO( Looking for a great RSS reader? Try FeedBeast! )
|)””’) Built with home-grown CodeProject components!
-”-”-
|
|
|
|
|
hi everyone.
when you select the day, month or year in the DateTimepicker control (i.e. 08/26/2008 ) suppose here i have selected the year,
when i click the Up Arrow key it will increment the year automatically but how to do that by pressing any other key.
regards
Vinayskvs
|
|
|
|
|
vinaykskvs wrote: Please help me its urgent
So what?
This is annoying and rude. You have the same post on this page.
vinaykskvs wrote: when i click the Up Arrow key it will increment the year automatically but how to do that by pressing any other key.
Have you ever hear of events...Fire a event when some key is pressed. On that event do whatever you want to do.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
yes but i didnt get any reply may be my question is not proper for others to understand, u people will just find these things like does he repeated the same question or he is asking something else..
But hardly few people will give the solution not Good soln but the Best..
so plz if u have understood my question please try to help me.
|
|
|
|
|
vinaykskvs wrote: But hardly few people will give the solution not Good soln but the Best..
Did you even read what I answered...or your definition of solution is cooked CODE
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
i dont know. i modified my question a bit in the previous post can u plz see that solve my problem...
|
|
|
|
|
private void dateTimePicker1_KeyPress(object sender, KeyPressEventArgs e)
{
int LiYear = dateTimePicker1.Value.Year + 1;
dateTimePicker1.Value = new DateTime(LiYear, dateTimePicker1.Value.Month, dateTimePicker1.Value.Day);
}
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
hello
iam working on report for printing barcode serial
but i hvae problem that report have custome size about 2*3.5 cm for each label
so i want to resize the details section to that size but i don't know how to do that it's y first work with barcode reorts and that project was created on .net 2003
can any one help me quickly
md_refay
|
|
|
|