how to run a program without loading a form but it would show a msgbox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shivananda
    New Member
    • May 2013
    • 9

    how to run a program without loading a form but it would show a msgbox

    Hi one & all , Hope every one doing well
    I am new to vb.net .
    Here i am trying to create a patch file after executing a program no3 fieldof a table is updated in sqlserver database ,its updating field successfully,
    here is one problem ,form is not hiding don't want to show the form and want to show only msgbox with a message "patch is created "
    But in my code that is not happening
    here is my code

    thanks in advance. :)

    Code:
    Imports System.Data.SqlClient
    Public Class Form1
        Dim con As New SqlConnection
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Me.Hide()
            Try
                con.ConnectionString = ("Data Source=SHIVA\SQLEXPRESS2005;Initial Catalog=userdata;Persist Security Info=True;User ID=sa;password=pavanvsmginfo")
             
                con.Open()
                Using com As New SqlCommand("update  users set no3=3", con)
                    com.ExecuteNonQuery()
                    com.Dispose()
                    con.Close()
                End Using
            Catch ex As Exception
                MessageBox.Show("patch file is created ", "infomation", MessageBoxButtons.OK)
    
            End Try
            
    
        End Sub
    End Class
    Last edited by Rabbit; May 28 '13, 04:58 PM. Reason: Please use code tags when posting code.
  • IronRazer
    New Member
    • Jan 2013
    • 83

    #2
    You can try setting the forms Opacity property to (0.0). Also putting the messagebox inside the Catch is only going to show it if there is an error. I am not sure if that is what you intended or not.
    Code:
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Me.Opacity = 0.0
            Me.ShowInTaskbar = False 'Set this if you don`t want it to show in the taskbar
    
            'Do whatever you want here
    
            MessageBox.Show("patch file is created ", "infomation", MessageBoxButtons.OK)
        End Sub

    Comment

    • vijay6
      New Member
      • Mar 2010
      • 158

      #3
      Here i am trying to create a patch file after executing a program no3 fieldof a table is updated in sqlserver database
      Hey shivananda, if this is your requirement means then why not you go for console application instead of windows application?

      Comment

      • shivananda
        New Member
        • May 2013
        • 9

        #4
        thanks Viji,
        Sorry to ask this , what is this console application and how to use this can explain please......... ....
        thank you

        Comment

        • shivananda
          New Member
          • May 2013
          • 9

          #5
          thanks IronRazer ,
          good job , its working
          thanks a lot, thank you :)

          Comment

          • Oralloy
            Recognized Expert Contributor
            • Jun 2010
            • 988

            #6
            shivananda,

            Please mark IronRazer's answer as correct - this is so that other folks, trying to do the same thing, do not have to dig through all the posts to find the solution.

            --Oralloy

            Comment

            • vijay6
              New Member
              • Mar 2010
              • 158

              #7
              Hey shivananda, see this link...

              Console Application

              Comment

              Working...