|
I see, I'm still use TextBoxes for that, with some masking if appropriate.
The NUD does a lot of masking (and limit checking) but seems to accept multiple decimal points,
so it may still need validation. And I wish there were a way to hide the up/down arrows...
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
I am faceing a problem when a try to populate datagrid thread rise an exception ...
Object reference not set to an instance of an object.
at System.Windows.Forms.DataGridViewTextBoxCell.PaintPrivate(Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, Int32 rowIndex, DataGridViewElementStates cellState, Object formattedValue, String errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts, Boolean computeContentBounds, Boolean computeErrorIconBounds, Boolean paint)
at System.Windows.Forms.DataGridViewTextBoxCell.Paint(Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, Int32 rowIndex, DataGridViewElementStates cellState, Object value, Object formattedValue, String errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)
at System.Windows.Forms.DataGridViewCell.PaintWork(Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, Int32 rowIndex, DataGridViewElementStates cellState, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)
at System.Windows.Forms.DataGridViewRow.PaintCells(Graphics graphics, Rectangle clipBounds, Rectangle rowBounds, Int32 rowIndex, DataGridViewElementStates rowState, Boolean isFirstDisplayedRow, Boolean isLastVisibleRow, DataGridViewPaintParts paintParts)
at System.Windows.Forms.DataGridViewRow.Paint(Graphics graphics, Rectangle clipBounds, Rectangle rowBounds, Int32 rowIndex, DataGridViewElementStates rowState, Boolean isFirstDisplayedRow, Boolean isLastVisibleRow)
at System.Windows.Forms.DataGridView.PaintRows(Graphics g, Rectangle boundingRect, Rectangle clipRect, Boolean singleHorizontalBorderAdded)
at System.Windows.Forms.DataGridView.PaintGrid(Graphics g, Rectangle gridBounds, Rectangle clipRect, Boolean singleVerticalBorderAdded, Boolean singleHorizontalBorderAdded)
at System.Windows.Forms.DataGridView.OnPaint(PaintEventArgs e)
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.DataGridView.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
please help
|
|
|
|
|
Can't you trace the code?
|
|
|
|
|
i used try catch in datagrid papulation code but Exciption bypass evry thing and takes me in Main function..
|
|
|
|
|
Please post the code at which point the exception arise and lines above it, so we can have some context to help you.
|
|
|
|
|
Your subject line suggest you're trying to update the DataSource property of a DataGrid control from a background thread you created. If this is true, you cannot do that. You MUST Invoke a method on your form so the UI thread updates the control's DataSource. You cannot manipulate controls from any other thread other than the one that created the control.
|
|
|
|
|
hey guys
i need to draw a circle that represents a clock, but i must also be able to dynamicly change the color of different time intervals inside that circle... (almost like a pie chart)
eg
5-6 red
6-7 yellow
7-8 green
8-9 yellow
9-10 green
how would i go about starting this project?
ps. i know nothing about drawing
thanx
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
think BIG and kick ASS
you.suck = (you.passion != Programming)
|
|
|
|
|
You'll need to create your own control, deriving from the Control class. Override the OnPaint method in this, then use the Graphics object provided in it's PaintEventArgs argument to draw whatever you want. Hint: Graphics.FillPie might come in handy.
Standards are great! Everybody should have one!
|
|
|
|
|
thanx, ill look into it
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
think BIG and kick ASS
you.suck = (you.passion != Programming)
|
|
|
|
|
hey
ok so i started the control project, the class inherits UserControl by default. should i leave that as is or replace it with Control?
thanx
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
think BIG and kick ASS
you.suck = (you.passion != Programming)
|
|
|
|
|
Doesn't really matter, UserControl allows you to use the visual designer, which you probably won't be needing in this case.
Standards are great! Everybody should have one!
|
|
|
|
|
Hi All,
I am drawing rectangle on the form. (VC#)
I am able to resize the rectangle when rectangle is at zero degrees.
For example, if i want to resize top right:
rect.Y = mousepoint.Y;
rect.Height += OriginalRect.Top - mousepoint.Y;
rect.Width += mousepoint.X - OriginalRect.Right;
whereas 'rect' is rectangle after resize, 'mousepoint' is mouse pointer while mouse move.
But
When i rotate rectangle at, say 30 degrees, I have the problem, the above code won't work.
I need to change x, y, width and height. How to do it? I just want a clue.
I want to make sure that i am using Visual Studio 2005. This app is NOT WPF.
Thanks in advance.
|
|
|
|
|
Use the Rectangle's Inflate method.
Standards are great! Everybody should have one!
|
|
|
|
|
dear friends,
i hope you are all fine,i am new in this community and this is my first post.actually i am doing my final year priject of image processing in C# .tell me how i can learn C# quickly and easily and also about the implementation of aindane algorithm.
thanx
messages sent here
|
|
|
|
|
waqas shah wrote: dear friends,
i hope you are all fine,i am new in this community and this is my first post.actually i am doing my final year priject of image processing in C# .tell me how i can learn C# quickly and easily and also about the implementation of aindane algorithm.
thanx
What? You are doing your final year project, as in you have been in the class all year, and now you are doing your final project? And NOW you need to learn C#? Didn't pay attention in class huh?
waqas shah wrote: also about the implementation of aindane algorithm.
use google.
I'm going to become rich when I create a device that allows me to punch people in the face over the internet.
"If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer
|
|
|
|
|
Justin Perez wrote: I'm going to become rich when I create a device that allows me to punch people in the face over the internet.
are they for sale yet???
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
think BIG and kick ASS
you.suck = (you.passion != Programming)
|
|
|
|
|
Unfortunately not, however, I expect a functional prototype at the end of the second quarter, 2008. They will be issued to worthy members to combat ignorance and stupidity here at CP, free of charge.
I'm going to become rich when I create a device that allows me to punch people in the face over the internet.
"If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer
|
|
|
|
|
awsum! cant wait!
then we could rule the cyber world
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
think BIG and kick ASS
you.suck = (you.passion != Programming)
|
|
|
|
|
Hello,
Any help would be great! I have tryed the (datagrid.columns[1]. visable = false) the issue is that, using this method shrinks all the rows of data in the data grid view. Even if i set the row height, it seems to make no difference. I need to set which columns are shown in code, and I change the data source for the data grid view as needed. I have also tryed (datagrid.columns[i].width = 0) and (col.width = 0), both produce the same result, the column width is changed to 0, but you can still see the column, only it appears as a line, and if you are hiding a few columns then it is very noticable. Also you can streach the columns with a width of 0 back out again.
any help would be great.
Thanks to thoes who replyed to my first question for this, I did try all suggestions.
thanks, J
|
|
|
|
|
jasper018 wrote: I have tryed the (datagrid.columns[1]. visable = false) the issue is that, using this method shrinks all the rows of data
Where have you tried this and what do you mean it shrinks the rows?
jasper018 wrote: Thanks to thoes who replyed to my first question for this, I did try all suggestions.
So this is a repost of the same question?
only two letters away from being an asset
|
|
|
|
|
answer question 1: when using the (datagrid.columns[i].visible = false) method when the data grid load in the form, the row height is set to 0, even if i reset is before it is displayed it does not change. so there for all the rows appear shrinked. I do not know why this is happening, and no matter what I do, or set, it seems to set the row height to 0.
answer question 2: Yes I have posted this question before... the responses I had gotten, though helpfull, did not help with my problem, i am really stumped with this one.
|
|
|
|
|
try to use AutoSizeMode=Fill for any visibale columan,, hope it will work
|
|
|
|
|
Thanks i am going to give that a try!
|
|
|
|
|
Thanks for the reply! )
That did not seem to work either
|
|
|
|
|
Hi,
I am reposting this message,plz help me to fix it.
I have written code for sending mails using c#.I am facing the following problem with this.
Mail Body is not showing up for Meeting requests/mail received through Lotus Notes. The meeting request is shown correctly when viewed through the Outlook with the body showing up but not in Lotus Notes.
Here is the code i am using,
msg.From = new MailAddress(From);
msg.Subject = Subject;
msg.SubjectEncoding = System.Text.Encoding.Default;
StringBuilder strBodyText = new StringBuilder();
strBodyText.AppendLine(some string on logical criteria);
msg.Body = strBodyText.ToString();
msg.BodyEncoding = System.Text.Encoding.Default;
msg.IsBodyHtml = false;
msg.Priority = MailPriority.High;
SmtpClient client = new SmtpClient();
client.Port = 25;//or use 587
client.Host = smtpServer;
client.Send(msg);
Plz help me...
Thanks in Advance
Alok...
|
|
|
|
|