|
Found the solution. Take a look at: http://dotnetjunkies.com/WebLog/rtgurskevik/archive/2005/01/19/45958.aspx
|
|
|
|
|
hi all,
I am developing a C# Application.I want to read Network computer file.In here I can not use open File dialog.I want to hard code all the thing..
Can any body please tell me how to do it?
First I want to know how to access Network computer using C#.?
where can I hardcode Network computer Name and Password in C# Application?
regards,
pubudu.
|
|
|
|
|
I have designed a sample chat server application. then I converted into a windows service and test it on my machine. It was working properly without giving any errors. but when I install the service in a machine that has o be connect through the internet that server side application automatically closes within a minute or two. May I know the reason for that. it gives the error "Remote machine( server) refuse acccepting the connection". PLease help me. if you have a solution for this I will appreciate it also.
Dilan
|
|
|
|
|
Hi all,
I need to create word document from a web application on the client not the web server. What do I have to use? and after I created the document can I run a spell check on my web page using the word spell checker?
Thanks in advance
Ben
|
|
|
|
|
I apologise for being light on specifics, but I know it can be done ( I've seen it done in a classic ASP app ), but the user obviously needs Word installed on every client machine.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thanks for that, any more info to specify how it can be done would be greatly appreciated. The client has word installed
regards
Ben
|
|
|
|
|
Hai,
I am having two C# applications.I need to use some functions of second application in First application.
How I can do this.I need to know complete steps.
I am sure somebody can show my way.
Thank you,
Rahul.
|
|
|
|
|
One option is at design time:
If the other application's EXE name is called 'app.exe', copy it to 'app.exe.dll' and add it as 'Reference' to your project.
Right-click on "References" in the Visual Studio's Solution Explorer, choose "Add Reference..." and "Browse..." for the 'app.exe.dll' .NET tab of the dialog.
If app.exe has a class "MyClass" in the namespace "MyApp.MyNamespace" you can use it in your application with "MyApp.MyNamespace.MyClass myClass = new MyApp.MyNamespace.MyClass()", for example.
/EDIT: The reason for renaming the app.exe to app.exe.dll is, that Visual Studio allows only .DLL files as file references.
|
|
|
|
|
Another option at runtime:
You can load a .NET Assembly at runtime.
Assembly assembly = Assembly.LoadFile("app.exe");
Type type = assembly.GetType("MyApp.MyNamespace.MyClass");
object obj = Activator.CreateInstance(type);
"type" may be -null- if the given type name wasn't found in the assembly.
You can create an object without loading the assembly through the "Activator.CreateInstanceFrom" method.
Just search for some articles on how using Assemblies that are loaded at runtime and/or the Activator class. I prefer the implementation at design time though.
|
|
|
|
|
Hai Zarrab,
Thanks much for your incredible help and information.I will follow the way that you have specified .
Thank you,
Rahul.
|
|
|
|
|
I want to know whenever a system is asked to restart, shut down...in order to control them to do what I want (e.g. forbid user to restart). What should I do.
Thank you
|
|
|
|
|
Hi there.
I want to import a function of a simple C written DLL from within a C# project. Not that difficult... actually. But I keep getting exceptions.
I spent hours for searching on the internet for articles that may help me but didn't find anything that helped me to solve my problem.
This is the C code out of the header:
[code]typedef struct tagHuffmanObj
{
int has_incomplete;
int incomplete_node;
char incomplete_byte;
}HuffmanObj;
void Compress(char *dest, const char *src, int *dest_size, int *src_size);
void Decompress(char *dest, const char *src, int *dest_size, int *src_size, HuffmanObj *obj);[/code]
Q1: What's the correct declaration for importing the functions?
I tried different things on this, none of it worked. I keep getting NullReference exceptions but I don't know what exactly that means. Some time ago (1+ year) I read that NullReference expeptions come up upon passing wrong arguments to the function.
The function in the dll is exactly compiled as given in the header, I recompiled the DLL since it's open source.
public static extern void Compress(ref byte[] dest, ref byte[] source, ref int destSize, ref int srcSize); for example.
I mean.. if C doesn't care about datatypes, the function would simlpy read the byte code given by dest/source with the given lengths. And I just pass it a byte array with the ascii codes.
Q2: Is it correct, that the C# struct for HuffmanObj is just 2 int variables and a byte variable in the same order? Just to be sure..
I'm kinda confused on how to import the functions properly.
|
|
|
|
|
How does this work exactly? I am trying to use a mouse cursor postion get and set function, but I can't remember how it worked exactly. Thanks for all the help.
|
|
|
|
|
Accessors look like this:
public Point MouseCursorPosition
{
get { return m_MouseCursorPosition; }
set { m_MouseCursorPosition = value; }
}
When getting a value from "MouseCursorPosition", it returns the value of the private member m_MouseCursorPosition. With accessors you can make private members to be read-only if needed. Simply leave the set accessor and only implement the get accessor.
As an option you can add more code to the bodies of get/set if needed. For example..
public Bitmap Picture
{
get { return m_Picture; }
set
{
m_Picture = value;
RedrawBitmap();
}
}
.. you draw the new picture that is set. Accessors are cute
|
|
|
|
|
Ok, I feel alot closer, but I am now getting this error.
m_MouseCursorPosition does not exist in the namespace.
I also need to know how I store that point to use in another function.
|
|
|
|
|
Hi
I had an instance XmlSchema class, and now wont to get an elemetn which
included in this schema by one ID (without iteration over all document), how i can do this.
And else how i can to get corresponded XmlDocument object for this XmlSchema object,when i see my instance in "watch view" i watch what this schema has Document property but i can't get acess to one due to protection level.
THANK.
|
|
|
|
|
Hi all
I need to access an Excel workbook and update certail cells and then print it. I want to use C# to access and update the Excel workbook. I can access it no problem using the ADO method and Microsoft.Jet. However I am struggling to update a specific named cell using the Update sql statement from my C# windows application.
Unfortunately the type of data is more fitting for a spreadsheet type layout, otherwise I would have used a database.
Can anyone assist me in this matter.
Thank you
kobus
|
|
|
|
|
I am trying to open a file from c:\windows\assembly, using opneFileDialog but it does not open it, other files are opened very easily.Why?
|
|
|
|
|
I am not familiar with that but I doubt that c:\Windows\Assembly or c:\winnt\assembly contains any files. It is the global assembly cache, isn't it?
So if you want to open an assembly, try looking in C:\WINNT\Microsoft.NET\Framework\v1.1.4322 or C:\Windows\... and the version of your choice if you installed more than one version of the .NET Framework (ie .net framework 1.0/1.1/2.0).
|
|
|
|
|
Hi ,
I want to compare the text of two html pages and then highlight the changed text.Do you have any idea on how to do this
|
|
|
|
|
hi all, hope some one can help me iv got a bit of a prob.
iv got a server and client sending data using sockets and tcp/ip.
The client sends the server some text and the server gets the byte[] array and then converts it into a string.
For the most part it is ok, however there are some characters it can not convert. i am using System.Text.ASCIIEncoding.ASCII.GetString() to turn the byte array into a string.
an example of a character it will not convert is §.
any help would be grate.
Thx
|
|
|
|
|
The character is not an ASCII character. Try System.Text.UnicodeEncoding.Unicode.GetString
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I have created a Windows Form that allows the user to enter a couple of file names, and select a couple of checkbox styled options. I have placed "Browse" buttons by the textbox that holds a filename. When Browse is selected, the OpenFileDialog is displayed. This all works like I expect. However, when I select Open in the OpenFileDialog, it runs the additional code in the Browse_Click method, then returns to the calling form. This is not what I want; I only want it to return when the user selects the AcceptButton or the CancelButton.
The code that shows the form in question:
<br />
formImportDatabase frmImport = new formImportDatabase();<br />
DialogResult dr = frmImport.ShowDialog();<br />
if (DialogResult.OK == dr)
{<br />
...<br />
}<br />
The Browse_Click code:
<br />
if (DialogResult.OK == openFileDialog.ShowDialog())<br />
{<br />
textBoxDestinationDB.Text = openFileDialog.FileName;<br />
} <br />
How can I keep the dialog box displayed until the AcceptButton or CancelButton is selected?
Thanks,
Glenn
|
|
|
|
|
I've had this problem recently - the trouble is that if your form is set to close on Accept or Cancel messages, a child form that closes with those messages will close your form as well. Get rid of all automatic form closure handling in your dialog, handle the click for OK and Cancel, and set DialogResult manually before calling this.Close();.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thanks. That did the trick, once I went into the generated source and remove the DialogResult.Cancel that had been placed in the browse button section.
Thanks again.
--G
|
|
|
|