|
int pos = myString.IndexOf(name);
--
David Wengier
Sonork ID: 100.14177 - Ch00k
|
|
|
|
|
Is it really the right way!?
well.... okay then..!
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
hello,
when the below line runs it creates the dll in the application's bin\Debug directory. i'm trying to write it to a directory of my choice instead. i posted this last week. did anyone come across how i might do this. i'll post more code if you need it but the example that's basically the same thing i'm doing is at.
http://www.codeproject.com/csharp/cscompiler.asp
compilerResults = codeCompiler.CompileAssemblyFromSource(compilerParamaters, sourceWSProxy);
i've played around with some of the Parameter properties and couldn't get it to work. so maybe i'm just not doing it right. CompilerResults has a PathToAssembly property but that's after the fact.
any help is appreciated. By the way Tom, if you read this good book on C#. we've got 2 copies of it in our office.
thanks
Orion
|
|
|
|
|
i've tried a couple of things but still doesn't work. or maybe i'm doing something wrong.
i can get it to write to some directory but then the file(dll) that i'm creating loses its COM component qualities. so its no longer considered a dll, although it still has the extension. at least that's the error i get when i go to Add Reference to the newly created dll. i'm attempting to pass the path in as part of the OutputAssembly CompilerParameter.
compilerParamaters.OutputAssembly = File.CreateText(@"C:\WUTemp\" + fileNameAssembly).ToString();
the other thing i've tried is to create it InMemory and then try to write to some directory. this produces the same result. the file is created with the dll extension but its missing the components.
any thoughts??
thanks
Orion
|
|
|
|
|
Shouldn't that be, compilerParamaters.OutputAssembly = @"C:\WUTemp\" + fileNameAssembly ?
James
Simplicity Rules!
|
|
|
|
|
James,
Thanks! that works. Yes Simplicity rules yet again. now i feel like a dumb ass,, but i don't care it works ;~))
Orion
|
|
|
|
|
I have a Windows Form component that responds to the mouse wheel. On my test form it is the only control and works great, but in my application I have a browser control and serveral instances of that control. In this situation the control never responds to the scroll messages. I have tried setting the focus to it when the mouse enters and all sorts of other things. Any suggestions?
BTW, I'm betting James knows.
Joshua Guy Sonork ID: 100.9944
ICQ: 519642
Hotmail: JoshuaJGuy@hotmail.com
|
|
|
|
|
Joshua Guy wrote:
BTW, I'm betting James knows.
Off the top of my head...
in Form_Load
Application.AddMessageFilter(myComponent as IMessageFilter);
in your component
public class MyComponent : ......, IMessageFilter
{
......
bool IMessageFilter.PreFilterMessage(ref Message m)
{
if( m.Msg == 0x020A )
{
m.HWnd = this.Handle;
WndProc(ref m);
return true;
}
return false;
}
} Hopfully that'll work, I haven't tested it
James
Simplicity Rules!
|
|
|
|
|
In the same dir as my EXE I have a dir with some files in it. I want to get the filename for all those files!
How!?
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
string [] files = System.IO.Directory.GetFiles(Application.ExecutablePath);
James
Simplicity Rules!
|
|
|
|
|
Thaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaak youuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu!
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
Flowers for a flower ?
Crivo
Automated Credit Assessment
|
|
|
|
|
Hi!
To make it very simple:
I have a Form, with one Button in it.
I want to fake a buttonpress on the Button in my code. In other words, create the buttonpressed event without clicking the button, so the Button will deliver the event to its registered listeners.
HOW?
This is to be used in for example scripting of an Active X component (or any Form with controls) by sending keystrokes or mouseclicks etc.
Nico
|
|
|
|
|
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
|
|
|
|