|
But on both posts your name or intials show up as the user name. How did you do that?
I won't dignify your question with an answer. Yes, I program in VB6, but only because I'm addicted to eating!
|
|
|
|
|
Hi,
Heath had mentioned using a Dataset.Merge for a returned dataset from web service to client but I can't seem to find any property called Merge.
Where do I find it ?
Thanks,
JJ
|
|
|
|
|
It's clearly there:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemDataDataSetClassMergeTopic2.asp
Are you sure you declared it as System.Data.Dataset? And not as a datatable or something like it?
|
|
|
|
|
Hi,
I need to test if an Array object is empty. What's the best way to do this? Also how do you determine if an object exists?
Thanks,
JJ
|
|
|
|
|
MrJJKoolJ wrote:
I need to test if an Array object is empty. What's the best way to do this?
Do you mean contains no elements, or that all the elements are null?
The Length property will tell you how many elements are in an array.
If you mean the second option then you would have to iterate over the array testing for null on each element.
MrJJKoolJ wrote:
Also how do you determine if an object exists?
I don't understand this at all. If an object exists you will have a reference to it somewhere. Although, sometime objects will exist that you don't have a reference to anymore and by that time it is too late because the garbage collector will be clearing it out soon anyway.
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
The Second EuroCPian Event will be in Brussels on the 4th of September
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
|
|
|
|
|
That the array contains no elements. Also How do you test if all the elements are null?
On the object question, I need to know how to test if an object exists for a reference.
Thanks,
JJ
|
|
|
|
|
MrJJKoolJ wrote:
Also How do you test if all the elements are null?
bool allNull = true;
foreach(object element in myArray)
{
if (element != null)
{
allNull=false;
break;
}
}
At the end of this code snippit, allNull will be true if all the elements of the array are null. It will also be true if the array is of zero length (so you might need to test for that condition also)
MrJJKoolJ wrote:
On the object question, I need to know how to test if an object exists for a reference
Okay, a bit of confused terminology here. You want to tell if a "variable" references an object or not. For that, it looks like Otis_69 responded with the correct answer for that.
Does this help?
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
The Second EuroCPian Event will be in Brussels on the 4th of September
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
|
|
|
|
|
To determine if the object exists you do this:
if(yourobject != null)<br />
{<br />
}<br />
else<br />
{<br />
}
I hope you have the right word (exists) because an object that doesnt exist is just a name. If it does exist, then it has a refrence to a location in memory that holds the object.
To test if the array is empty, do as the guy before me said, use yourarray.length() because by empty, i assume you mean the name exists, which holds a refrence to the object (so the object exists) but there is no data in the elements...
//Otis
|
|
|
|
|
|
no problem...
All these other people may be guru's, and thats why they dont understand that you want a simple answer... Where as i just learned that stuff a few weeks ago in college, and im new to C#, i can help you on a more "noob" level (no offense, if any)... Thats the problem with smart people and trying to help others, they think that we know a shitload of stuff, when they gotta think like the person they are helping... :P I've seen it happen too many times, id ask something, and a whole bunch of guru's will come along and say "do this, do that" and it gets so complicated, they seem to think im whining, when i just cant understand, and then they tell me i cant program C# anymore because i have to know everything... then a someone with just a bit more skill comes along, and tells me what to do... and im satisfied. I say that noone should ever ask a guru what might seem to be a simple question to them.
Well, thats just my little grudge, ill prolly get flamed for it, and called a whiner, when im just stating my opinion, with some facts :P I just ignore them :P
//Otis
|
|
|
|
|
If you want to determine if the elements of your Array reference an object of a class, you have to iterate over your Array and test them against null, like Colin said.
Alternatively, you could use an ArrayList instead of the Array. The ArrayList class provides the Count property which tells how many objects really exist in your ArrayList.
www.troschuetz.de
|
|
|
|
|
Is it possible to force an event to trigger in C#?
eg. I would like to trigger the Button2_click event every time the Button1_Click event is triggered, so as to execute BOTH the code of Button1_Click and Button2_Click.
.::YF::.
|
|
|
|
|
Register one event handler for both of them.
Mazy
"One who dives deep gets the pearls,the burning desire for realization brings the goal nearer." - Babuji
|
|
|
|
|
Thanx! You really helped me out!
.::YF::.
|
|
|
|
|
Hi,
Let's face it, I don't understand how I can do the following. Let's explain a little :
* I have an online database (in fact mysql). I access this base through ByteFX's MySQLDataAdapter.
* I have an application which can read data from it but also can modify them WITHOUT necessary doing a fill (updating the database back). In fact, this application could be closed without having done the updates, inserts, etc.
* I do not have issues like online datas beeing changed or multi-people acceding the datas. Only this application is responsible of the database.
What I want is when the application is launched again, the "not updated yet" part of the datas are still there. So I need to cache them in some file.
What is the best approach to do that ?
Thanks
|
|
|
|
|
I use mousemove to draw a rectangle,when mousemove , it draw many rectangle,but i only want the latest rectangle,how to erase the previous rectangle.
It's the best to give a simple sample! thanks!
|
|
|
|
|
Before you you draw the rectangle, clear the graphics object.
dim g as graphics = mybase.creatgraphics
g.clear
g.drawrectangle(p,0,0, 15,15)
Aaron Eldreth
TheCollective4.com
My Articles
While much is too strange to be believed,
Nothing is too strange to have happened.
- T. Hardy
|
|
|
|
|
I have hit snag with my current project, I was hoping one of you guys and girls could help a newbie out.
As part of the process I call an external app, when called Windows gives a warning. This warning is not a critical one, but not one I can disable either.
What I would like to do is simply close that window from my code and let the external app get on and do it's job. What I am hoping is that someone can point me in the right direction as to how to close the window concerned as it lies outside my project.
Many thanks in advance,
Chris
|
|
|
|
|
To close a window, you need to call some low level Win32 APIs such as FindWindow, PostMessage, or EndDialog.
I don't know how to do this in C#, you can probably use unmanaged C++. The complication is, you may need to execute the code (the low level api calls) from the external program. If you do it from your own program, it may not work or it may generate "access denied" error.
In other words, you need to know how to build a dll, load it into an external process, and execute it. The whole thing is pretty complicated, here are some articles on CodeProject that might help you:
Three Ways to Inject Your Code into Another Process[^]
Sending windows messages from a remote machine[^]
Good luck.
My articles and software tools
|
|
|
|
|
You will have to P/Invoke FindWindow and SendMessage or PostMessage, sending the WM_CLOSE message, to the window handle that is returned by FindWindow.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
When i debug my project, it displays this message :
Here
And it auto break debug, what happen? please help me. Thanks
|
|
|
|
|
Which line of code does this happen? See the ArithmeticException class in MSDN too see what cause this in that line\.
Mazy
"One who dives deep gets the pearls,the burning desire for realization brings the goal nearer." - Babuji
|
|
|
|
|
Hi,
(Working on a windows Form)
I'm importing names from a db into a listbox. I want the user to be able to click on one of the names and have text boxes populated (from the db). In order to do this, I need to assign the id number (from the db) to each name in the listbox. Can you assign a hidden value to items listed in listbox?
thanks,
Ron
|
|
|
|
|
|
Thanks for the info Maysam!
I'm new to programming... it seems like a lot of code to
hide a variable with each listbox item. Is it because listbox
was not originally designed to have hidden variables?
Ron
|
|
|
|