|
Is it possible to lock the first column in the datagrid control (Windows Forms version) so that it can never scroll off the viewable area? Similar to the way Excels 'freeze panes' feature works.
|
|
|
|
|
Hi
I have a new class witch I want to make "public" for the .NET framework, I have tried to use the "gacutil", but when I try to compile a new calls file using my "namespace" it fails.
Thanks
|
|
|
|
|
To use an assembly that is in the GAC you still must reference the assembly. What seems to be a pain is that you can't just reference it and let it find it in the GAC you have to specifically tell it where to look for your assembly.
What I did was I made a copy of my assembly and placed it in the same directory as my source, I then added a reference to that (using VS.NET or the /r: compiler switch). Once the code is compiled (and the assembly is in the GAC) you no longer need the local copy of the assembly.
Now when you run your code, if the assembly isn't located in the current directory it will search the GAC for it.
HTH,
James
Sonork ID: 100.11138 - Hasaki
"My words but a whisper -- your deafness a SHOUT.
I may make you feel but I can't make you think." - Thick as a Brick, Jethro Tull 1972
|
|
|
|
|
Hi James,
And THX (again)
It works great But let's say I want to be able to add the "reference" from the GAC with VS. Even though I have added the DLL to GAC, the listbox don't have my DLL?
My question is really how do I re-distribute my application without changing to much - it would be great if xcopy and maybe GACUtil was the only task.
If I copy my DLL to the webapp's BIN folder, and add the Reference it displays a full path(URL), and If I copy the webapplication to another URL - it would fail right?
Thanks
Felix
|
|
|
|
|
Felix Nielsen wrote:
But let's say I want to be able to add the "reference" from the GAC with VS. Even though I have added the DLL to GAC, the listbox don't have my DLL?
It seems odd, but VS.NET doesn't show assemblies that are in the GAC. Instead it shows assemblies from a few pre-defined locations. The best place to put such an assembly would be $windows_dir\Microsoft.NET\Framework\$dotnet_version\
Then VS.NET will see your assembly and add it to the list.
Now the question you need to ask yourself is "What about my assembly warrants making it available to everyone?" 9 times out of 10 there isn't really any reason to put something in the GAC. The GAC should be used for assemblies that other people/companies will want to use in their products where the size of the assembly is large enough to warrant not keeping a local version.
Felix Nielsen wrote:
If I copy my DLL to the webapp's BIN folder, and add the Reference it displays a full path(URL), and If I copy the webapplication to another URL - it would fail right?
Nope, VS.NET references everything relative to the project directory. So if you place an assembly in your bin directory the project file stores it as "bin\myAssembly.dll". If it can't find it there, it will begin a search to find it in other locations too. I don't recall what those locations are off the top of my head though.
HTH,
James
Sonork ID: 100.11138 - Hasaki
"My words but a whisper -- your deafness a SHOUT.
I may make you feel but I can't make you think." - Thick as a Brick, Jethro Tull 1972
|
|
|
|
|
I'm creating a registry editor exaclty like RegEdit and I want to know how Can I retrieve Value who have DWORD and Binary type to put it in a ListView
I use Convert.ToString(...) but if I got a binary or DWORD value i got System.Byte[] or System.String[];
How can I fix this ?
|
|
|
|
|
Hello,
My name is Aaron Thompson. I am a student at Columbus State Community College in Columbus Ohio. I am currently seeking an AAS of Computer Programming Technology, but I have just started into the world of programming, so my experience is very limited. I am currently working on a report about C#, and needed to get some primary research data. I have done a good deal of research into what C# is about, but I am still very much the novice. The report is for my Business English class, and does not have to be overly technical. I have a few questions that I have come up with, and any responses would be greatly appreciated. If possible could I have responses by Friday March 1st? If you would like to send your response to my hotmail account, it is aroconthom@hotmail.com.
If you could also leave your name and an email address for reference information that would be great. If you would not like to be referenced, your response is still very much welcomed. Thank you in advance for any help I receive.
1) What features of C# do you find to be the most useful to you when writing programs? Please list 3-5 features for your answer.
A few examples of what I would consider features of C#: The garbge collection mechanism, access to the .NET libraries for easier inheitance of code, and the ability to manage memory yourself by declaring a section of code as "unsafe".
2) What features would you consider to be the least useful to you when writting programs in C#? Please list 1-3 for your answer.
3) What previous programming languages experince do you find the most helpful when learning to use C#?
Such as profficiency with Visual Basic, C, C++, JAVA, etc.
|
|
|
|
|
Aaron T. wrote:
What features would you consider to be the least useful to you when writting programs in C#? Please list 1-3 for your answer.
Managed code/garbage collection...
No direct and easy access to the Windows API
No "real" pointers
I can't compile native applications
Aaron T. wrote:
What previous programming languages experince do you find the most helpful when learning to use C#?
Such as profficiency with Visual Basic, C, C++, JAVA, etc.
I have programming C++ for a looong time, and some years ago I also programmed in Delphi, both have been very usefull when trying out C#.
(Delphi and C# is both designed by Anders Hejlsberg, and several features in common)
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Thank you so much for your response, it will help a great deal. From everything that I have read experince in C++ will make learning C# the easiest. Doing this paper has helped me to get a direction of what areas I want to concentrate on in programming.
Have a great day,
Aaron T.
|
|
|
|
|
Hi All,
I have just finished creating a small application and now am trying to package it into a setup program so that I can distribute it to the people concerned.
Where is the nice easy package creator program? or what am I supposed to do now?
Thanks,
|
|
|
|
|
If you are using VS 6.0 then it comes with a version of InstallShield that you can use to package your distribution.
If not then I would suggest getting a trial for any of the commercially available packages of trying the Windows MSI installer if your package warrants this complexity. Otherwise search google for shareware installer packages and give them a try. I have seen many over the years and it really depends on how complex your application is with regard to dependent components, license installation, registration, uninstall, user input and control of installation, etc.
Success is measured by ones ability to mask complexity with simplicity.
|
|
|
|
|
Sorry forgot to mention that I am using C# and VS.NET Beta 2 (still waiting for my retail version to arrive in the UK).
I have the package installer that comes with VS 6.0 but it doesn't accept my C# project as a project?
Thanks,
|
|
|
|
|
Within VS.NET go to File -> Add Project -> New Project then select the Setup and Deployment option and choose Setup Project or the Setup Wizard. Follow the steps and it will create a MSI install package for you.
|
|
|
|
|
There we go, I knew there had to be a simple smart way ...
You have made my day..
Cheers
|
|
|
|
|
Just wondering how to inherit 2 classes in c#?
Anyone there could provide some example code?
|
|
|
|
|
If you're referring to multiple inheritence (mi), it is not supported in C#. However, in addition to inheriting from a single class you can also inherit from as many interfaces as you like.
Cheers,
Tom Archer
Author, Inside C#
|
|
|
|
|
Hi, I've created a C# dll using the Class library project and have a method in there that just returns a string. I'd like to import this dll in my code dynamically instead of doing the "Add reference". How would I do that? Any help would be greatly appreciated.
|
|
|
|
|
I personally have not tried this, but this might point you in the right direction:
Try assem = System.Reflection.Assembly.Load(...) to load your assembly (C# dll).
Then t = assem.GetType(...) to get your type (class, etc.)
Then use t.InvokeMember(...) to call a method
You can also get a ConstructorInfo object through the Type object and create an instance of your class through ConstructorInfo.Invoke(...)
--
Peter Stephens
|
|
|
|
|
*sigh* I should have reloaded the forum before I started typing my post :-P
James
Sonork ID: 100.11138 - Hasaki
"My words but a whisper -- your deafness a SHOUT.
I may make you feel but I can't make you think." - Thick as a Brick, Jethro Tull 1972
|
|
|
|
|
Yes, but yours has better examples
--
Peter Stephens
|
|
|
|
|
First you use Assembly myAssembly = Assembly.LoadFrom(myDllPath); passing in the location of your dll.
Next you use the returned Assembly and search it for the Type you want to use (Type is the overlying type for all classes, enums, structs, delegates, and events). Type myType = myAssembly.GetType("myNamespace.myType"); .
Now with your type you can create an instance of it. object myInstance = Activator.CreateInstance(myType);
Now comes the fun part, invoking your method!
string retVal = (string) myType.InvokeMember("MyMethodName", BindingFlags.Public | BindingFlags.InvokeMethod, null, myInstance, new object { /* any parameters here, leave empty if there are none */ } );
There you have it! You've not successfully run a method and retreived the return value.
To sum it up again,
Assembly myAssembly = Assembly.LoadFrom( myDllFilename);
Type myType = myAssembly.GetType( myTypeName);
object myInstance = Activator.CreateInstance( myType);
string retVal = (string) myType.InvokeMember(
"myMethodName",
BindingFlags.Public | BindingFlags.InvokeMethod,
null,
myInstance,
new object { }
); HTH,
James
Sonork ID: 100.11138 - Hasaki
"My words but a whisper -- your deafness a SHOUT.
I may make you feel but I can't make you think." - Thick as a Brick, Jethro Tull 1972
|
|
|
|
|
Thanks guys. Great help
|
|
|
|
|
hello
is there any way to determine what exception has been thrown ?
i have a try and catch block catching Exception all the time, but id like to know what type of Exception is thrown for an object that throws one, so i know what to catch.
|
|
|
|
|
The documentation should tell you what exceptions to expect, but you can get the name by doing the following
catch(Exception e) {
string name = e.GetType().Name;
Console.WriteLine("Exception: {0}", name);
}
Or just take the catch out altogether and the framework will catch it, in the description it should give the name of the exception.
James
Sonork ID: 100.11138 - Hasaki
"My words but a whisper -- your deafness a SHOUT.
I may make you feel but I can't make you think." - Thick as a Brick, Jethro Tull 1972
|
|
|
|
|
public const byte[] FOO = {0x00FF, 0x00FF, 0x00FF,
0x00FF, 0x00FF,0x0074,
0x0001, 0x0003,0x0075,
0x0003, 0x0000};
I get a complie error
Array initializers can only be used in a variable or field initializer. Try using a new expression instead.
And yes i have tried using new, i cant get that either, someone help me plz ?
|
|
|
|