|
How about:
int foo(IntPtr Buffer, int BufferLength, ref IntPtr Image);
I don't know if that will work or not, but it looks alright.
My current favourite word is: Bacon!
-SK Genius
|
|
|
|
|
Hi,
in addition to the above, if you need to pass a pointer to a managed object,
use the GCHandle class to pin the object, get its handle, pass it on, and when
done free the handle.
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.
|
|
|
|
|
Good Day,
I wish to have a Console Application in my WinApp. I want to use it as a sort of a "Debug Window".
Is there an easy way to do this?
Thanks!
It is said that the most complex structures built by mankind are software systems. This is not generally appreciated because most people cannot see them. Maybe that's a good thing because if we saw them as buildings, we'd deem many of them unsafe.
|
|
|
|
|
goto project properties, select ouput type console application.
it will give gui+console. (which is very useful for debug).
|
|
|
|
|
Hi,
can any one guide me to How to Connect Ordacle DB via C#? Also, on the client macghine where I will deploy the final executable, do I require to provide separate oracle driver also? Or only using only the executable any client machine eill be able to connect?
Any pointers will be useful
Thanks,
Sankalp
|
|
|
|
|
Dude make a habbit of searching the answer on google before posting here
Go to www.google.co.in type there ' connect orcale c#.net' and you will find many .. links to your question ....
For a quick reference use ODBC data provider to connect to oracle database..
Regards
Dont Get Paid for the Hours you worked, Get Paid for the Work You Have Done in an Hour.
|
|
|
|
|
I have a windows form with some buttons and I am having problems setting focus on the buttons.
Basically an array of buttons gets passed in to the the form along with a default button as follows:
public void Show (Button defaultSelectedButton, Buttons[] btns)
{
foreach (Button btn in btns)
pnlButtons.Controls.Add (btn);
defaultSelectedButton.Focus();
}
however defaultSelectedButton.Focus(); does not seem to have any effect and the button with focus is always the first button that was added to pnlButtons.
Does anyone know how to apply focus to a particular button?
thanks
|
|
|
|
|
You might try first changing the foreach statement to just a for statement. Foreach statements have an odd way of going through the order of the buttons.
If that doesn't do anything, if the for loop you might try comparing a unique aspect of the defaultSelectedButton and a button in the btns array (I would use the Text property). If the unique aspects are the same then use focus.
If neither of those suggestions work, post back and I will try to find another alternative.
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 homepage Oracle Studios[ ^]
|
|
|
|
|
Why no use AddRange for adding the buttons, then you don't need a loop at all.
And of course, make sure that defaultSelectedButton is actually one of the buttons in the array, rather than a copy of.
I've just done a test and dynamically added a button to a form, then called myButton.Focus() and the newly added button does indeed get focus, so check up on the defaultSelectedButton, because it should be working.
My current favourite word is: Bacon!
-SK Genius
|
|
|
|
|
I just wanted to add that
- foreach loops the same way as you would probably yourself with a for loop (nothing strange about it, really) --> keep the foreach, because it is better readable
- Focus should work, to debug the problem, try to have a look at the ActiveControl property of your form or user control to see, which control has currently the focus and whether that control has a validate method that prevents setting of the focus to the button.
Urs
-^-^-^-^-^-^-^-
no risk no funk
|
|
|
|
|
Good Day,
Say I have a single dimension array as such:
int MyArray[] = {1,2,3,4,5,6,7,8,9,10};
And I want to randomly shuffle the contents of that array. I did a google search but the results were crappy.
Can anyone guide me on how to accomplish my this task?
Thanks!
It is said that the most complex structures built by mankind are software systems. This is not generally appreciated because most people cannot see them. Maybe that's a good thing because if we saw them as buildings, we'd deem many of them unsafe.
|
|
|
|
|
apstring ShuffleAns(apstring ans1,apstring ans2,apstring ans3,apstring ans4)
{
apstring set[4]={"","","",""};
set[0]=ans1;
set[1]=ans2;
set[2]=ans3;
set[3]=ans4;
apstring rval[4]={"","","",""};
bool used[4];
for(int k=0;k<4;k++)
used[k]=false;
Random* rnd=new Random();
int icount=0,inum=0;
while(icount<4)
{
inum=rnd->Next(0,4);
if(used[inum]==false)
{
rval[icount]=set[inum];
used[inum]=true;
icount++;
}
}
apstring rvalr=rval[0];
rvalr+='~';
rvalr+=rval[1];
rvalr+='~';
rvalr+=rval[2];
rvalr+='~';
rvalr+=rval[3];
return rvalr;
}
This is some code that I reuse/translate for all of my projects. I took this particular piece of code from my who wants to be a millionaire program so this randomizes the answers. (This is in C++ by the way, but if you have problems understanding it just post back)
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 homepage Oracle Studios[ ^]
|
|
|
|
|
Thank you Mr. Stockwell, I'll just convert this to C#.
It is said that the most complex structures built by mankind are software systems. This is not generally appreciated because most people cannot see them. Maybe that's a good thing because if we saw them as buildings, we'd deem many of them unsafe.
|
|
|
|
|
I do it differently. Instead of shuffling the whole array (or collection), I randomly select one item from it at a time as needed.
|
|
|
|
|
Why so complicated? Why not something simple like this? 'Hope I'm not missing something obvious.
int MyArray[] = {1,2,3,4,5,6,7,8,9,10};
// Shuffle array by stepping through each element and swapping each number with another random position.
Random RandomIndex = new Random();
for (int i = 0; i < MyArray.Length; i++)
{
int randomIndex = RandomIndex.Next(MyArray.Length);
int temp = MyArray[i];
MyArray[i] = MyArray[randomIndex];
MyArray[randomIndex] = temp;
}
|
|
|
|
|
Hi My Friends,
In the Microsoft Visual Studio .Net sometimes when you change your source code and run your project the changes not effect.
In this cases you should from the Build menu select Clean Solution and run again.
My question is :
1. Why ?
2. How can prevent from this action ?
Best Regards,
Reza Shojaee
|
|
|
|
|
1 - I've never seen this happen to a C# solution, but the main reason is that the compiler tries to be intelligent and only build what has changed. If it gets confused, it may not build your code, saw this in VC6 all the time
2 - you can't, if you could, then why would you need the option in the first place.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Thank you
I use C# 2005 and sometimes haven't this problem but sometimes have problem, I think perhaps one option exists that prevent intelligent compiling, and I search for this option.
Best Regards,
Reza Shojaee
|
|
|
|
|
Do you use project or file references for your projects in your solution to reference each other?
Project references are preferable.
Just a guess though
-^-^-^-^-^-^-^-
no risk no funk
|
|
|
|
|
how to use crystal report
|
|
|
|
|
I don't personaly know, but the search box is an amazing tool.
Try typing crystal reports into it. I think the second reult seems promising.
My current favourite word is: Bacon!
-SK Genius
|
|
|
|
|
I hope you're joking.
Try reading the forum guidelines, and the article I link to in my sig. Also, consider that a book, or even an online article, will provide more indepth help that is more suited to a base line question like that one.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
hi dude.
This question proves that you are a beginner . try searching google for your question....here you can get only suggestions.. like read books , ' what is google ' ........... its better to have a search on google before asking a question...
Happy programming
Dont Get Paid for the Hours you worked, Get Paid for the Work You Have Done in an Hour.
|
|
|
|
|
Figure out that one first.
|
|
|
|
|
Hi,
Got some problem with a set of buttons i've positioned in workspace area in my MDI-form. Not really GUI-standard but client wants it this way. The trouble is they "float" over every child form opened within my MDI (click event opens child form). Been looking in button class as well as form class for a property solving my problem. Thinking of something like "always on top"...
Kind of a newbie problem but any input most welcome!
Best Regards
Anders
|
|
|
|