yes now i am doing that only as i want to avoid user saving the files in administrator tools folder, i am checking is he selected theat folder and if yes then i am showing him a msg telling he cant save there...
It is not easy.
One idea would be:
-open the document, using Microsoft.Office.Interop.Word.
-select the active document, word.ActiveDocument.Select()
-copy current selection, word.Selection.CopyAsPicture()
-get the Image by calling Clipboard.GetImage()
Hi I am writing a small program , I need to find the application data folder which exists in c:\documents and settings folder. I need to know the exact path, if the user has installed the windows in d:\ then it should look at d:\. Even if I could know the windows installation drive then I think it would help ? I got some code in VB but i cannot use it in csharp . Any suggestions would be appreciated.
Public Function GetTheWindowsDirectory() As String
Dim strWindowsDir As String ' Variable to return the path of Windows Directory
Dim lngWindowsDirLength As Long ' Variable to return the the lenght of the path
strWindowsDir = Space(250) ' Initilize the buffer to receive the string
lngWindowsDirLength = GetWindowsDirectory(strWindowsDir, 250) ' Read the path of 'the windows directory
strWindowsDir = Left(strWindowsDir, lngWindowsDirLength) ' Extract the windows 'path from the buffer
I am having a problem with passing a button and form to a method.
Let me explain detail.when i click a button it will send some this button and a form to a method. The method then do some job. like
Let's see if I understood what you mean.
You want to pass to the showForm method the type of form to show and then show the kind of form desired.
If it's so, you can use reflection in the following way:
void ShowForm(Type formType)
Form frm = Activator.CreateInstance(formType) as Form; // your type must be some kind of form
if (frm != null)
frm.Show(); // showing the form
// formType is not a form, handle the error
I can't realy understand your examples (your naming is srtoa off), but if you just try to pass a button and a form to a method, they are objects like everything else.
void PassButton(Button myButton)
//Do stuff with myButton
void PassForm(Form myForm)
//Do stuff with myForm
//Form is the class from which your own for is derived, you can cast it to
//any form you want or use your selfmade Form (like F_Main)
Last Visit: 31-Dec-99 18:00 Last Update: 26-Jul-21 20:57