|
As far as i know, you can generate the code dyanmically using ILEmit.. but i never tried that one.. Could u plz explain us, y do u need this funcnality.. insted. u could serialized the data store it in the database. and get it thru object and bind with front end controls.(winforms controls)
|
|
|
|
|
Thanks for your reply.
I'd like to generate a new WinForm class file according to known classes. For example, we already have an entiry class Customer, and I shall generate a form to show this business entity. The new form class is just what I want to automatically generate. I don't know if I made my thinking clear.
|
|
|
|
|
Rather than generating code automatically, you could come up with a form class that uses
reflection to display the relevant members of whatever object you give it.
Search CodeProject, MSDN, or Google, for reflection.
Luc Pattyn
|
|
|
|
|
I want to have 2 buttons. Push button 'A' and it prints to a network printer. Push button 'B' and it prints to a connected usb printer. Is there a way to specify a printer when printing WITHOUT popping up the print dialog?
thanks!
|
|
|
|
|
no... sorry... or can try some third party tools..
|
|
|
|
|
Hey, just brushing up on my regex in .NET. I used Stallman's lex/yacc back in the day (1990s) and made great programs with very little effort. Its seeming to me that MS in .NET has emphasized good lexical scanning but is short on building grammatical constructs a la YACC, short of laborious groupings (...). For instance, in YACC I could define a whole grammar for a language (for instance, a language that dictates chip layout) in about 1 page of code.
Is there something similar and as powerful with .NET Regex class? Maybe I'm overlooking something.
Thx.
|
|
|
|
|
I am trying to generate a system information as follows;
*********************************************************************
Process nfo = Process.Start("C:\\Program Files\\Common Files\\Microsoft Shared\\MSInfo\\MSInfo32.exe");
nfo.WaitForExit();
************************************************
Works fine but want to save it to a file, so tried this
*******************************************************
Process nfo = Process.Start("C:\\Program Files\\Common Files\\Microsoft Shared\\MSInfo\\MSInfo32.exe /nfo c:\\temp\\SysInfo.nfo);
*********************************************************************
bu does not work.
How can I run it with the arguments?
thanX in advanced
PC
|
|
|
|
|
You can pass arguments to the exe by calling
public static Process Start (string fileName, string arguments)
but this only helps for real arguments, not for the goodies offered by the DOS shell,
such as input and output redirection.
For these, you still need the Process class, but then you must set several of its
properties, and in order to do it correctly, you normally have to launch up to 3 extra
threads to take care of input, output and error streams.
I'm pretty sure either CodeProject (or Google) could offer you a reasonable example.
Luc Pattyn
|
|
|
|
|
thanX Luc,
the Process.Start(file,swtich) atually worked.
|
|
|
|
|
OK I searched google, msdn etc. but didn't find exactly what I need.
Can someone provide decent reference on this topic (hope detailed enough with best practice examples etc.).
Thanks!
|
|
|
|
|
|
Thanks... of
Bassam Saoud wrote: of links here [^] this one I already have 8/10 links visited (they are purple )... and on MSDN I know there is lot to read... but figured out their best text is for VB.net 2002, exactly one you posted right now actually... so although there is bunch of material I'm still not happy... but I'll keep searching.
Instead can someone say, how often we actually use n-tier architecture in day by day examples?
I know huge data-base things should be n-tier, but what about things that don't access net or some other shared resource?
how about n-layer?
|
|
|
|
|
Hi,
in my program i started a thread to do some work and i want to change the text on a Form in another thread. I always get an exception.
Could someone tell me what's the easiest way to do that? I read about delegates etc. Sounds NOT so easy
Thank you in advance.
|
|
|
|
|
Indeed, all operations on a Control (creation and modification) must be handled by a
single thread, normally that is the "UI thread". If another thread is involved,
you must use Invoke (or BeginInvoke) to launch the operation on the right thread.
There is a simple example in my article http://www.codeproject.com/csharp/LPSokoban.asp[^]
Look at the method pasteOneMove(): it is called by "thread" which is not the UI thread;
so pasteOneMove invokes itself, effectively making it run again, but this time on the
UI thread.
Luc Pattyn
|
|
|
|
|
Ah, thanks, now i understand
|
|
|
|
|
Hi, i search a livrary in Framework .NET 2.0 to see the resources of systems connected to my computer in my lan, but i didn't find it.
What is the library/method to see network resources of systems in my lan (like DriveInfo, DirectoryInfo etc... for local resources)?
Thanks and excuse me for my bad english!
|
|
|
|
|
Plz try this code.........This done with the help of WMI
using System.Management;
Private ManagementObjectSearcher OS;
Private ManagementObjectSearcher CS;
Private ManagementObject Mgmt;
OS = New ManagementObjectSearcher("SELECT * FROM Win32_OperatingSystem");
CS = New ManagementObjectSearcher("SELECT * FROM Win32_ComputerSystem");
For Each Mgmt In OS.Get
{
String OSName = Mgmt("name").ToString();
String OSVersion = Mgmt("version").ToString();
String ComputerName = Mgmt("csname").ToString();
String WindowsDir = Mgmt("windowsdirectory").ToString();
}
Next
For Each Mgmt In CS.Get
{
String strManufacturer = Mgmt("manufacturer").ToString();
String StrModel = Mgmt("model").ToString();
String strSystemType = Mgmt("systemtype").ToString;
String strTPM = Mgmt("totalphysicalmemory").ToString();
}
Next
Or u can also use
Environment
Environment.OSVersion.Platform like.....try other methods......
Parwej Back...............DON of Developer.......
Parwej Ahamad
g_parwez@rediffmail.com
|
|
|
|
|
Excuse me but i don't understand where i can find data about the drives of other systems connected to my pc.
Thanks for help!
|
|
|
|
|
I've used the exaple but i don't understand where i can see the others systems in my LAN . . .
|
|
|
|
|
I am having trouble changing icons. I edit them with the resource editor, but when I display them they haven't changed.
For instance, I'll add an icon to my assembly (Add New Item/Icon file). Then I change its Build Action Property to Embedded Resource. Then I edit the default to what I want. I retrieve the icon with:
Icon icon = new Icon(this.GetType(), "MyIcon.ico");
Lastly, I assign this icon to the Icon property of a StatusBar panel.
The problem is that the icon hasn't changed from the default image. No amount of saving, rebuilding, etc. seems to do anything. Viewing the image in the icon editor shows the changed icon. Viewing the file with a drawing program (e.g Paint) shows the changed icon. I just cannot get it to diaplsy on my form correctly.
What am I doing wrong?
Dave
|
|
|
|
|
Yes, I have had some trouble with that too.
An icon may contain several images, typically at different resolutions;
typically 16*16 and 32*32 would be present.
On Visual Studio 7.1 look at menu Image/Current Icon Image Types.
Which image of the icon file gets used depends heavily on circumstances;
it may be different for:
- the task bar button
- the form's icon
- Windows Explorer showing small icons
- Windows Explorer showing large icons
Furthermore, Windows Explorer sometimes caches the icons used in a folder
(I am not sure, maybe in Thumbs.db which may be invisible, depends on your settings).
So when designing an icon, you should edit all images it contains,
and you may want to delete the icon cache file if you can find one.
Luc Pattyn
|
|
|
|
|
Thank you, this solved most of my problems.
I must say that all this is not very intuitive. Multiple icons in one file? Also, it would be nice if the IDE's Icon Editor displayed all the images in the file or gave you a hint that there may be more than one. Oh well.
Another question: You mentioned that the icon plucked from the file depends on circumstances. Is there any way of extracting a specific icon from a file? For instance, I get the icon with:
statusBarPanel.Icon = new Icon(this.GetType(), "MyIcon.ico");
This seems to look for the 16x16 icon. What if I had a circumstance where I wanted a specific size (color...) rather than the default?
Thanks,
Dave
|
|
|
|
|
Well, all those images together form only one icon, so you better make sure they all
look alike.
I know of no way to pick a specific image from an icon.
If you want to pick a specific icon from many, keep them well apart, i.e. in separate
files, or in separate resources.
BTW there also exists a way to pack multiple icons (each possibly with multiple images)
into a single file, I have forgotten all details tho. Maybe its called an icon list ?
Luc Pattyn
|
|
|
|
|
I think your problem is that you are calling "MyIcon.ico" so it's looking for that file in the current directory. If you are embedding the ico as an ebedded resource it won't be there.
You'll need to use Reflection to get the embedded Icon.
System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
System.IO.Stream stream = assembly.GetManifestResourceStream("WindowsApplication3.Icon1.ico");
Icon icon = new Icon(stream);
this.Icon = icon;
|
|
|
|
|
if you hav ur icons on the resource manager, it is easy to pic the icons. VS hav some built in functions for that
use the following code.. (not tested)
statusbar.Icon = global::namespace.Properties.Resources.icon;
namespace - give your name space name.
icon - name of the image added in the resource manager.
hope this helps
|
|
|
|