Click here to Skip to main content
15,905,558 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: how to prevent a user from clicking the ADD button more than one time without saving or discard/close the form entirely Pin
Tarakeshwar Reddy29-Apr-11 11:26
professionalTarakeshwar Reddy29-Apr-11 11:26 
GeneralRe: how to prevent a user from clicking the ADD button more than one time without saving or discard/close the form entirely Pin
waner michaud29-Apr-11 12:29
waner michaud29-Apr-11 12:29 
GeneralRe: how to prevent a user from clicking the ADD button more than one time without saving or discard/close the form entirely Pin
Tarakeshwar Reddy29-Apr-11 16:10
professionalTarakeshwar Reddy29-Apr-11 16:10 
AnswerRe: how to prevent a user from clicking the ADD button more than one time without saving or discard/close the form entirely Pin
LloydA11130-Apr-11 11:26
LloydA11130-Apr-11 11:26 
QuestionRedirect another application output to CMD Pin
Herboren29-Apr-11 6:59
Herboren29-Apr-11 6:59 
QuestionRe: Redirect another application output to CMD Pin
Eddy Vluggen30-Apr-11 22:16
professionalEddy Vluggen30-Apr-11 22:16 
QuestionOpen a word document inside a child form in vb.net? Pin
waner michaud28-Apr-11 9:57
waner michaud28-Apr-11 9:57 
AnswerRe: Open a word document inside a child form in vb.net? [modified] Pin
Luc Pattyn28-Apr-11 11:21
sitebuilderLuc Pattyn28-Apr-11 11:21 
You can insert one managed Form into another by setting the former's TopLevel property false, and its Parent to the latter. You need to do something equivalent to Word's main form (which isn't a managed Form).

So this is what I would try: open the Word process with Process.Start, then invite its main window into your Form by setting its parent (use P/Invoke to call SetParent[^] in user32.dll); I don't know about the native support for TopLevel, I can only hope you won't need it.

Here is my first try in VB.NET:
    Private Sub btnWord_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnWord.Click
        Dim p As Process = Process.Start("H:\test.doc")
        Dim word As IntPtr = p.MainWindowHandle
        Dim panel As IntPtr = Me.Panel2.Handle
        SetParent(word, panel)
    End Sub

    <DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _
Public Shared Function SetParent(ByVal hWndChild As IntPtr, ByVal hWndNewParent As IntPtr) As IntPtr
    End Function


Smile | :)
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

modified on Tuesday, May 3, 2011 7:37 AM

AnswerRe: Open a word document inside a child form in vb.net? Pin
gilchinger2-May-11 20:23
gilchinger2-May-11 20:23 
AnswerRe: Open a word document inside a child form in vb.net? Pin
Luc Pattyn3-May-11 1:42
sitebuilderLuc Pattyn3-May-11 1:42 
GeneralRe: Open a word document inside a child form in vb.net? Pin
gilchinger4-May-11 21:37
gilchinger4-May-11 21:37 
Question[VB.NET 2010] Get paths from selected files from Shell\Explorer ContextMenu Pin
The Mighty Atom27-Apr-11 5:36
The Mighty Atom27-Apr-11 5:36 
AnswerRe: [VB.NET 2010] Get paths from selected files from Shell\Explorer ContextMenu Pin
The Mighty Atom30-Apr-11 6:29
The Mighty Atom30-Apr-11 6:29 
QuestionHow to use Dataset1.xsd in ReportViewer VS2010? Pin
Paramu197327-Apr-11 5:30
Paramu197327-Apr-11 5:30 
AnswerRe: How to use Dataset1.xsd in ReportViewer VS2010? Pin
Paramu197330-Apr-11 19:41
Paramu197330-Apr-11 19:41 
QuestionSyntax question Pin
nlarson1127-Apr-11 4:01
nlarson1127-Apr-11 4:01 
AnswerRe: Syntax question Pin
_Erik_27-Apr-11 4:16
_Erik_27-Apr-11 4:16 
GeneralRe: Syntax question Pin
nlarson1127-Apr-11 4:32
nlarson1127-Apr-11 4:32 
GeneralRe: Syntax question Pin
nlarson1127-Apr-11 15:07
nlarson1127-Apr-11 15:07 
GeneralRe: Syntax question Pin
_Erik_28-Apr-11 1:31
_Erik_28-Apr-11 1:31 
GeneralRe: Syntax question Pin
nlarson1128-Apr-11 3:48
nlarson1128-Apr-11 3:48 
AnswerRe: Syntax question Pin
Jason Vetter27-Apr-11 4:22
Jason Vetter27-Apr-11 4:22 
QuestionTree View Pin
vijay248227-Apr-11 1:40
vijay248227-Apr-11 1:40 
AnswerRe: Tree View Pin
Johan Hakkesteegt28-Apr-11 2:59
Johan Hakkesteegt28-Apr-11 2:59 
QuestionHelp section inside a small app.. Pin
waner michaud26-Apr-11 8:47
waner michaud26-Apr-11 8:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.