Click here to Skip to main content
15,888,286 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am currently creating a Background Application with Notification icon . I have 2 console application (ModuleRegistry.vb & ModuleWatcher.vb) that runnning in the background and I want to add both code into One Windows Form (which is my Notification icon). I already added those 2 console app's (module) code into my Project in Solution explorer. But I dont really know how to call these 2 coding into my windows form.

For example,if I want to call/add another form in Windows form, the coding is
VB
FormsName.Show()
. Any help would be appreciate.

What I have tried:

below is my full code:
VB
 Public Class FormNotify
    
    Private Sub FormNotify_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
      

    End Sub
    Private Sub ExitToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles ExitToolStripMenuItem.Click

        Application.Exit()

    End Sub

    Private Sub FormNotify_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing


        Select Case MsgBox("There are some files you have not save in Google Drive?" & vbCrLf & "Do you want to save it?", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
            Case Windows.Forms.DialogResult.Yes
                e.Cancel = True 'cancel the form closing event
                FormLogfile.Show()


            Case Windows.Forms.DialogResult.No
                'Nothing to do

        End Select


    End Sub

   
End Class
Posted
Updated 18-May-17 2:18am
v4
Comments
CHill60 18-May-17 8:04am    
"its not working" is not helpful. What is happening?
[no name] 18-May-17 8:07am    
You lack a fundamental understanding of how programming works. You should get a book on programming and work through it. Or better than that, take a class in programming that will teach you how to make and use functions in your programs.

1 solution

It kind of depends on what exactly you are trying to do: normally console app code interfaces with the user directly vis Console.Read and Console.Write methods - which are not compatible at all with windows applications. So if you console code does any of that, it will need considerable redesign in order to work in WinForms.

If it doesn't, then it's relatively simple: just as you did in your console app, you call the methods and access the properties of your code from the module. The complication is that Windows apps shouldn't "block" the UI - which console apps do with abandon!

We can't tell you how to "fix this" - we have no access to your code, or any accurate idea of what it does, or how it does it!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900