|
Use the IsDBNull method. Example:
if (mysql_reader.IsDBNull(1) {
temp_name = null;
} else {
temp_name = mysql_reader.GetString(1);
}
---
b { font-weight: normal; }
|
|
|
|
|
Yep I tried that but got the same error message...
Will keep looking...
"Rules are for the obedience of fools and the guidance of wise men"
|
|
|
|
|
Phillip Hodges wrote: Yep I tried that but got the same error message...
Then you did something wrong, because that method works.
Where exactly do you get the error message, and what exactly is the error message?
---
b { font-weight: normal; }
|
|
|
|
|
Have you tried checking DBNull or IsDBNull()?
|
|
|
|
|
DBValue.IsNull (or something like that)
That should be DBNull.Value
Good luck...
V.
Stop smoking so you can: enjoy longer the money you save.
|
|
|
|
|
how to create the tab page control which is present in the project property window?
is that .Net componet is available for reuse?
sakthi
|
|
|
|
|
yea sure it is
jamil abou khalil
|
|
|
|
|
can u say its exact name and its namespace?
sakthi
|
|
|
|
|
please guide me about creating a horizontal dockable window within Mdi childform.
* I just want to create a MDI interface.
* a child form that can be minimized, maximized in MdiParent client area.
* Also a dockable window (similiar to output window in visual studio 2003) that makes it space with childform.
Please reply.
|
|
|
|
|
if you are creating an MDI, then all the childforms have bydefault the funcationality of minimized, maximized.
can you clear your question about dockable window (similiar to output window in visual studio 2003).
regards
sAqIb
"Our scientific power has outrun our spiritual power. We have guided missiles and misguided men."
Dr. Martin Luther King Jr.
|
|
|
|
|
Dear sAqIb!
I need a single dockable window (similar to output window in IDE) alongwith that child form in the area of Parent form.
Thank you.
|
|
|
|
|
I was looking for the same sort of functionalities described above.
Try
http://sourceforge.net/projects/dockpanelsuite/[^]
There is a good sample app to get you started too.
Set the parent form's IsMdiContainer property to true.
-- modified at 19:47 Wednesday 8th November, 2006
|
|
|
|
|
Thank you dear.
I have seen that project at sourceforge.net but how can i modify it for my functionality?
Can u guide?
Regards
|
|
|
|
|
Hi
I have a ComboBox control and i wrote comboBox1_SelectedIndexChanged() event for it.
Now ReFilling combobox causes to running SelectedIndexChanged() event each time when new item added to combobox and this slows the program or maybe cause to unwanted problems.
I use below code but i want a better way or setting a property of combobox which i don't know about it:
private bool allowCmbChange;
Form_Load()
{
allowCmbChange=false;
for (int i=0;i<10;i++)
{
comboBox1.Items.Add(i.toString());
}
allowCmbChange=true;
}
private void comboBox1_SelectedIndexChanged()
{
if (allowCmbChange==false)
return;
.
.
.
}
Thank you for helping me.
|
|
|
|
|
Hello,
Instead you could unlink the event before you start the Items.Add and link it agein when you are done.
Form_Load()<br />
{<br />
this.comboBox1.SelectedIndexChanged-= ...<br />
for (int i=0;i<10;i++)<br />
{<br />
comboBox1.Items.Add(i.toString());<br />
}<br />
this.comboBox1.SelectedIndexChanged+= ...<br />
}
All the best,
Martin
|
|
|
|
|
Why are you doing this in Form_Load? Doesn't it load once when the form loads?
|
|
|
|
|
Hi
I just wrote it in Form_Load for an example.
I all over the code section a have this problem.
|
|
|
|
|
Before you fill it, store the selecteditem.
Fill it.
Restore the selectedItem.
|
|
|
|
|
Hello guys,
it is annoying, but I don't know what I can do else.
I have a single Form, without any Windows controls. It is just black.
I do some paintings like graphs, diagtrams and stuff like this.
In the previous version I redraw everthing cyclically in the Paint-Method of the Form,
by using "this.Refresh" in a timer. But the timer cycle is too fast, I had a high CPU load.
Now, I have several invalidation rectangles of those graphic parts, which has to be really redrawn.
I put all that rectangle together in one region called "myRegion", by using the myRegion.Union(anotherRect).
Finally i call in the timer this.Invalidate(myRegion). Afterwards I clean up this Region for next timer cycle.
All needed parts are redrawn correctly, but the CPU load is not much better.
I figured out, the more rectangles I combine with "myRegion", the more CPU load is needed.
I need urgent help. How can I fix this :-/
-- modified at 7:55 Wednesday 8th November, 2006
|
|
|
|
|
Is the display actually changing on each timer cycle? If it's not, you'd be better off driving the display off of changes in the data that creates the graphs as opposed to simply redrawing on each cycle no matter what. You could make this change to your code with very little work - do this data changing validation on the timer. In the long run, it'd be better to get rid of the timer completely, and make the drawing event driven, but at least you could check out the difference this way.
Also, with the invalidation of rectangles that you're doing - are you actually using the clip rectangle in your drawing code? If you're not actually using the clip recangle directly to determine what needs to be drawn, then the only speed gains you're getting is by GDI+ itself clipping, and that shouldn't be very significant (from your comment, it seems this is the case). Don't take this the wrong way - most of the GDI or GDI+ code I've seen that does this sort of thing has either ignored the clip rectangle or used it incorrectly - it can be difficult initially to use the clip rectangle correctly, and some apps may not benefit from it anyway - yours sounds like it would though.
-----
In the land of the blind, the one eyed man is king.
|
|
|
|
|
hi, thx fopr your reply.
Actually, I have have to update that paintings cyclically. There is no way out.
Your question concerning the rectangles,
actually I calculate few rectangles (Type Rectangle), where the redrwa has to take place.
Then, in the timer I make som myRegion.MakeEmpty(), afterwards I add those rectangles to this
myRegion with myRegion.Unioin(rectangle1), myRegion.Unioin(rectangle2), myRegion.Unioin(rectangleN)...
This works fine, and I can see, if an area outside the rectangles is not repainted, so I know that not the whole screen is repainted. I checked this also by disabling the double buffer (then it starts to flicker in that regions).
What did you mean with "clip recangle", isn't it that stuff mentioned above? Or is this a special type?
|
|
|
|
|
By invalidating regions, you are creating a clipping rectangle, and when Paint gets called, one of the properties of the PaintEventArgs is a "ClipRectangle". If possible, you should use this rectangle to only paint those items that got invalidated.
For instance, suppose you have two graphs on the screen, and your clipping region is around the 2nd graph (I apologize for the ASCII drawing here, I couldn't find a suitable image online quickly)
+--------------------------+
+---------------+ | +---------------+ |
| | | | | |
| | | | | |
| graph 1 | | | graph 2 | |
| | | | | |
| | | | | |
| | | | | |
+---------------+ | +---------------+ |
+--------------------------+
In your paint handler, you should be using this ClipRectangle value to draw only graph 2 - graph 1 has not been invalidated and does not need to be redrawn.
However, if your paint handler does not use the ClipRectangle value and draws everything, you are wasting CPU cycles, because not only does this not need to change, but the Graphics object passed into the handler is also setup with the clip rectangle value - and it won't even paint outside of that area (even if your drawing code does).
This is why only the areas you invalidated flicker when you turn off double buffering - the Graphics object has already been setup to clip the drawing, but you're still using CPU cycles attempting to draw outside this area.
-----
In the land of the blind, the one eyed man is king.
|
|
|
|
|
oh, nice!
This sounds really promsing. I didn't know, that that PaintEventArgs can handle such "Rectangles".
I cannot not test it currently, but: Is it possible, to take my calculated rectangles and combine/convert them into ClipRectangle?
-- modified at 13:50 Wednesday 8th November, 2006
HMmmm. it seems that I got you wrong. I should use that argument ClipRectangle to draw my stuff. But where does the form know, which areas has to be redrawn or which not? I thought I can affect this ClipRectangle. I'm wrong, right?
|
|
|
|
|
The ClipRectangle is the rectangle on the form that needs to be updated - and the form knows this from your calls to Invalidate, which is basically setting up the clip rectangle and telling the form that it needs to paint at some point. Other system events such as a different window moving over your form do basically the same thing, and only invalidate the portion of the form that it was over. If the entire form needs to be redrawn, the clip rectangle will be the size of your entire form, well the paintable portion of it anyway.
In short, you should use the ClipRectangle to determine which of your items need to be redrawn inside of the paint handler. Anything falling outside of the rectangle can be safely ignored, but anything that is entirely within or partially within that rectangle must be redrawn.
From the sounds of it, the only code of yours that needs to change is inside of the paint handler. You're already correctly invalidating only those portions of the form that need to be changed, now you just need to take it one step further inside of the paint handler and only draw those things that need to be drawn.
-----
In the land of the blind, the one eyed man is king.
|
|
|
|
|
"...now you just need to take it one step further inside of the paint handler and only draw those things that need to be drawn..."
sorry, but I don't get it. How it should look like?
I mean, I call this.Invalidate(myRegion), then the app goes into the Paint-method of the form.
What ist next step exaxactly? E.g. when I have a line to be drwan from left top corner to bottom right corner, and only a part has to be updated, where to tell this in the code, to ignore the outer parts of myRegion?
|
|
|
|