|
myButton.PerformClick();
James
Simplicity Rules!
|
|
|
|
|
No, it's not that easy
I want to send keystrokes/mouseclicks - to a Form.
Imagine an Active-X/COM object as a Form. I want to send keystrokes to it. Like "TAB"-"TAB"-"Enter"
Like an automation-tool or scripting tool (MS Scriptit).
Nico
|
|
|
|
|
Look at PostMessage and SendMessage API functions
Crivo
Automated Credit Assessment
|
|
|
|
|
Where exactly would I find the information on these functions? On MSDN I am assuming... It's a big place!
|
|
|
|
|
Do you guys have any reasons NOT to use hungarian notation in C#?
Like this:
int intMyAge = 12; // just kidding
bool blnILikeIt = true;
double dblSalary = 0.0;
-Øyvind
|
|
|
|
|
Yes, it makes code easier to read and less ugly
Thanks to intellisense I get the data type when I type it or if I hover my mouse of the variable for parameters to methods.
The only one I commonly use is the boolean prefix 'b', and thats only if I can't make the variable sound like its a boolean. For example, bRotateBob instead of just RotateBob.
My $0.02 anyway
James
Simplicity Rules!
|
|
|
|
|
You must be cursing me, I use Hungarian notation as a matter of course, even though VA has always told me the type. I find it helpful if I have to track, for example, three things to do with a Bob, like the bitmap, the position and the velocity I can do this: bmBob, ptBob, and uh, ptBob. OK, not the best example.....
Funny, I never use m_ in C# though, I wonder why I don't.......
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
Christian Graus wrote:
You must be cursing me
Only slightly
Christian Graus wrote:
bmBob, ptBob, and uh, ptBob. OK, not the best example.....
If its only used in one spot I prefer BobBitmap, BobLocation, BobVelocity.
If it is used elsewhere..
Bob.Bitmap, Bob.Location, Bob.Velocity
Luckily I've spent just enough time in MFC to understand most of the notation. You did surprise me by not using m_ though
James
Simplicity Rules!
|
|
|
|
|
James T. Johnson wrote:
Bob.Bitmap, Bob.Location, Bob.Velocity
You are of course right, but I'd tend to a struct only if there will be more than one, like the Actors in the SS.
James T. Johnson wrote:
You did surprise me by not using m_ though
I surprised myself, I am a stickler for m_ in C++. I dunno if I got the convention from a book, or if I just didn't bother starting what I didn't do right at first.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
Like you, I like HN and am trying to outgrow it with doing .NET development as in that environment it's simply not applicable for the following reasons.
1) In a VC++ app, I definitely use HN because MFC uses it. With so much time spent in the MFC source code, why have two separate coding standards? Go with MFC and use HN. However, With .NET, you're not stepping into MS code so their standards are not as important as with MFC.
2) As James already said, I can mouse over a variable in VS.NET and immediately see the variable's type.
3) With everything ultimately deriving from System.Object there's not the problem of mixing and matching types as in other environments.
Cheers,
Tom Archer
Author - Inside C#, Visual C++.NET Bible
A total abstainer is one who abstains from everything but abstention, and especially from inactivity in the af
|
|
|
|
|
I read somewhere:
The advantage of Hungarian notation is a reminder of the type of a variable.
In a true and pure OO language Hungarian notation would have no purpose. Here, variables are typeless - they contain an object, the type of which depends on the object itself, not the variable. There are no primitive types. In fact, Hungarian notation was developed for programming in C, which is not an object-oriented language.
If you have a type for a host variable, the proper way to name it is to use something like HostID. Then anyone can declare a variable to be of type HostID and use its operations without knowing or caring if it is a class, a structure, an integer, etc. This is called encapsulation and is a sign of good programming. It is one of the basic concepts of Object Oriented Programming. Notice that the HostID can be of any type and you don't care or want to know what type it is. You only need to know that it is the type required for a parameter to a function or what operations are available on the type.
Hungarian notation encodes type information into variable names. This is very useful in languages that don't keep track of types information for you. But in C#/Java it is completely redundant. Thus, the notation simply adds to obscurity.
Hungarian notation is, when all is said and done, a commenting technique. And the one great law of comments is that they lie. Comments are not syntax checked, there is nothing forcing them to be accurate. And so, as the code undergoes change during schedule crunches, the comments become less and less accurate.
In the .NET/Java environment, the development tool automatically detects the type of a variable when programming, so the need of viewing the type of a variable in the variable name disappears.
Ludwig
|
|
|
|
|
I want to have a group of 3 radio buttons and determine which one was checked without having to check if each one was checked. I am new to WinForms and have a web background where RadioButtons were indexed. Is there a way to do this? I will have many sets of these radio button groups and don't want to deal with the hassle of checking which one is checked with lots of code.
Thanks for your help.
c
|
|
|
|
|
anyone have a good book or reference or simply know how to do this:
im creating design time component that uses xml to populate a collection of control properties, which is then used to actually create and paste the controls to a form.
the difficult part is: once i have the collection of control definitions in the component, how do i actually paste them onto the form (ie: in the 'Component Designer generated code' area)?
do i open the cs file and write to it? that seems too crude.
how does msft do it?
im dying for a great (not good) book on advanced component and control coding in C#.
|
|
|
|
|
I believe you use Code DOM to do that, but I have no idea how to.
If you have a local bookshop (so you can thumb through it) take a look at .NET Windows Forms Custom Controls by Richard Weeks published by SAMS.
Here is a sample chapter.
Good luck,
James
Simplicity Rules!
|
|
|
|
|
I have created a C# messenger using .NET remoting to handle all the calls from the client apps. Now I`d like to add a "send file" option to the messenger. Is it possible using .NET remoting? Any suggestion?
|
|
|
|
|
[disclaimer]I know next to nothing about remoting[/disclaimer]
You could create a method which takes in pieces of the file; so you'd have something like this
BeginReceiveFile(long fileSize, string filename);
ReceiveFileChunk(byte [] bytes);
EndReceiveFile(string filename);
First you call BeginReceiveFile passing in the total file size and the filename, then you break the file into chunks; then when its all done you call EndReceiveFile to let the client/server know that its done.
Take what I say with a grain of salt though
James
Simplicity Rules!
|
|
|
|
|
Hi
I am first serialising an object and then to a *.dat
file
like this:
public void SerializeNow(DataSet dsout)
{
FileStream fs = new FileStream
(@"c:\scrpe1.dat",FileMode.Create);
BinaryFormatter b = new
BinaryFormatter();
b.Serialize(fs,dsout);
fs.Close();
}
and then I am trying to encrpt it using this Microsoft
code at
http://support.microsoft.com/default.aspx?scid=kb;EN-
US;q307010
Then I decrypt it which is good also.
Then I try to deserialise it where the problem occurs
and it gives me
an
error saying:
"Binary stream does not contain a valid BinaryHeader, 0
possible
causes,
invalid stream or object version change between
serialization and
deserialization"
If Do not do the inbetween encrypt and decrypt then
everything works
fine
no errors in deserialization.
What can be the problem???
Paresh.
|
|
|
|
|
When you decrypt how are you handling the second file? Did you change it to a memory stream or are you doing just what is listed?
James
Simplicity Rules!
|
|
|
|
|
hi there,
i'm exploring in the image-saving-in-different-formats direction and have got a question about the tiff-encoder:
the only two compression-modes, that i can use are EncoderValue.CompressionNone (wa-hey!) and EncoderValue.CompressionLZW(which works good) - anything else raises an System.ArgumentException: Invalid parameter used in the Image.Save(,,) method.
does someone know, if these encodervalues work as they should, somewhere? sometime?
:wq
|
|
|
|
|
ok, ccitt3 and ccitt4 can only be aplied to 1-bit (black/white) images - first part of the problem solved
so lets see, what the problem mit RLE is...
:wq
|
|
|
|
|
Can I find such a control (or similar) in C#?
Tomiga
|
|
|
|
|
There isn't anything built in; but you can always use the IE browser control and try to tie into its events.
Better yet You can use MC++ as your glue so you can use MFC and an MC++ class to communicate with your C# application.
HTH,
James
Simplicity Rules!
|
|
|
|
|
James T. Johnson wrote:
Better yet You can use MC++ as your glue so you can use MFC and an MC++ class to communicate with your C# application.
Sounds like a sticky mess.
Nick Parker
|
|
|
|
|
many xml have a DOCTYPE point to a dtd file in a far web site.
just like my download svg sample, it writes
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20001102//EN"
"http://www.w3.org/TR/2000/CR-SVG-20001102/DTD/svg-20001102.dtd">
well, either i use XmlDocument.Load(string) or
first open a XmlTextReader and then Load(XmlReader),
I face a long long wait(my internet link is rather slow). The reader try to get the dtd!
How can i instruct the reader to neglect it or tell it that the dtd sit in one of my hard disk's directory? Dont tell me to edit the DOCTYPE element manually to change the dtd url. That's the work the program should do.
Any way?
|
|
|
|
|
Jenny Li wrote:
That's the work the program should do.
Actually I think that is something it shouldn't be doing. It needs the DTD so how is it to know where one is except from the DOCTYPE. When you tell it to load an XML file it is going to do just that, if you don't want it to load the DTD then you should remove the DTD before telling it to load the document.
James
Simplicity Rules!
|
|
|
|