|
You're welcome.
“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,
I'm having problems with drag and drop of a cell value (copy) within one datagridview.
Please help.
|
|
|
|
|
Member 3031965 wrote: I'm having problems with drag and drop of a cell value (copy) within one datagridview
..and I'm having trouble understanding what your problem is as I appear to have left my psychic head at home today.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Dear All Hi,I am new to csharp, I want to create a Bar Graph without using the graphics class, I want to use a button and adjust its size so that it looks like a bar.I will populate the properties of the buttons (size,color,position) at the run time.
I need to create button instances at run time, I tried creating user objects of the button, but still I am unable to create many buttons at runtime.
Any help or ideas will be appreciated .
Thanks
|
|
|
|
|
Button b = new Button()
b.XXX = YYY;
this.Controls.Add(b);
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi Greeg,
If I had to create 100 buttons ,I do not want to write this code 100 times. I want something which is like cloning or creating Instances, for a user object button.Its not clear to me how we can do it in csharp.
|
|
|
|
|
Buy a book
int left = 0;
int space = 1; //pix
for ( int i = 0 ; i < nbButtons ; i++)
{
Button b = new Button();
b.name = i.ToString();
b.Text = i.ToString();
b.Left = left;
c.Controls.Add (b); //C is a user control
left += b.Left + b.Width + space;
}
|
|
|
|
|
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!
-”-”-
|
|
|
|