By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,815 Members | 1,143 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,815 IT Pros & Developers. It's quick & easy.

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

shivananda
P: 9
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. :)

Expand|Select|Wrap|Line Numbers
  1. Imports System.Data.SqlClient
  2. Public Class Form1
  3.     Dim con As New SqlConnection
  4.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  5.         Me.Hide()
  6.         Try
  7.             con.ConnectionString = ("Data Source=SHIVA\SQLEXPRESS2005;Initial Catalog=userdata;Persist Security Info=True;User ID=sa;password=pavanvsmginfo")
  8.  
  9.             con.Open()
  10.             Using com As New SqlCommand("update  users set no3=3", con)
  11.                 com.ExecuteNonQuery()
  12.                 com.Dispose()
  13.                 con.Close()
  14.             End Using
  15.         Catch ex As Exception
  16.             MessageBox.Show("patch file is created ", "infomation", MessageBoxButtons.OK)
  17.  
  18.         End Try
  19.  
  20.  
  21.     End Sub
  22. End Class
May 28 '13 #1
Share this Question
Share on Google+
6 Replies


IronRazer
P: 83
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.
Expand|Select|Wrap|Line Numbers
  1.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  2.         Me.Opacity = 0.0
  3.         Me.ShowInTaskbar = False 'Set this if you don`t want it to show in the taskbar
  4.  
  5.         'Do whatever you want here
  6.  
  7.         MessageBox.Show("patch file is created ", "infomation", MessageBoxButtons.OK)
  8.     End Sub
  9.  
May 28 '13 #2

100+
P: 158
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?
May 28 '13 #3

shivananda
P: 9
thanks Viji,
Sorry to ask this , what is this console application and how to use this can explain please.............
thank you
May 29 '13 #4

shivananda
P: 9
thanks IronRazer ,
good job , its working
thanks a lot, thank you :)
May 29 '13 #5

Oralloy
Expert 100+
P: 983
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
May 29 '13 #6

100+
P: 158
Hey shivananda, see this link...

Console Application
May 29 '13 #7

Post your reply

Sign in to post your reply or Sign up for a free account.