|
i want to make any application executing just once at the same time ..
i mean that when i run my application exe file it's opened and if i double clicked the exe file again it runs again..
how can i prevent that ?
pleas help
regards
|
|
|
|
|
Goto your project's properties and check Make Single Instance Application .
Trinity: Neo... nobody has ever done this before.
Neo: That's why it's going to work.
|
|
|
|
|
i use VB.net 2003 , there's no option like you wrote in project properties
many thanks for attention
regards
|
|
|
|
|
|
thanks Ben too much , but is there any way short than all that code ?
regards
|
|
|
|
|
You can leave out the windows message part since that is only used to activate the application if it is already running. All you have to do is use the mutex to know if your application is already running.
Ben
|
|
|
|
|
hi buddy...
if you are working in VB try this...
Private Sub Form_Load()
If App.PrevInstance = True Then
MsgBox "application already running", _
vbInformation, "Message"
End
End If
End Sub
|
|
|
|
|
i have tried internet for it,,, but of no use
please if can then just give the code for it
""""""""""i m using currencymanager,, the radio button does not change when at run time i navigate my records"""""""""
the default button that i checked always remain checked
please help
|
|
|
|
|
What is currencymanager ? Is it a control on your form ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
i m usin data reader in my login form.
wat i want to do is by data reader i can read data from tables
that i created. n be able to open other forms accordingly.
.....the problem is that that when i run the application,,no matter what i type
it only shows me the matter of first text box "you r logged on as student".....
here is the code
Imports System.Windows.Forms.Form
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.SqlClient.SqlCommand
Public Class logon
Inherits System.Windows.Forms.Form
Dim objsqlconn As SqlConnection
Dim logonselect As String = "select * from logon"
Dim objsqlcmd As New SqlCommand(logonselect, objsqlconn)
Dim dr As SqlDataReader
Public Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
objsqlconn = New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Documents and Settings\Administrator.WINXP_PRO_CORP.002\Desktop\WindowsApplication1\WindowsApplication1\Database1.mdf;Integrated Security=True;User Instance=True")
objsqlcmd = New SqlCommand
objsqlcmd.Connection = objsqlconn
objsqlconn.Open()
objsqlcmd.CommandType = Data.CommandType.Text
objsqlcmd.CommandText = "select * from logon"
dr = objsqlcmd.ExecuteReader()
Dim str As String
Dim a As New mdiparent
While dr.Read()
str = dr.GetString(0)
If str = "student" Then
MessageBox.Show("you are loged on as student")
a.Show()
End If
If str = "administrator" Then
MessageBox.Show("you are loged on as administrator")
a.Show()
End If
If str = "lass1" Or "lass2" Or "lass3" Or "lass4" Or "lass5" Or "lass6" Or "lass7" Or "lass8" Then
MessageBox.Show("you are loged on as lab assistant")
a.Show()
End If
End While
dr.Close()
objsqlconn.Close()
End Sub
Private Sub logon_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Focus()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.Dispose()
End Sub
End Class
can somebody please tell me where the problem is????
|
|
|
|
|
You are not doing any filtering on your query. Do you only have one row in the database? Have you checked what str = dr.GetString(0) actually returns?
|
|
|
|
|
and also to make sure that the changes have been made.
i m using vb.net express edition 2005. i m being able to delete the row at
rum time.but it appear again,,if i stop n run the form again
please help
|
|
|
|
|
Hi,
The datagrid control only shows data, and allows you and/or the user to manipulate that data. deleting a row from the datagrid doesn't automatically delete it from the datagrid's data source.
So the question is, what do you use as the data source for your datagrid, and how did you bind it to it? If it is a datatable, how do you populate it? If it is a dataset, where does the dataset get its data from?
Or in other words, deleting the row from the datagrid only affects what you see at that moment. You will have to delete the row from the data source as well.
Good luck,
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
I know this is probably real simple but for some reason I can't figure it out...
how can I code my own custom eyedropper? Or something which can get the color of any specified pixel on the screen?
thanks!
|
|
|
|
|
I came across a VB 2003 IDE quirk. If you have variables referenced in a select case stament in a sub the quick watch window seems to have trouble interacting with ide and cannot display the value of the variable.
Specifically, I had a datatable defined inside the case statement. If I would add the datatable to the watch window all of its properties displayed "Error: cannot display value" in the value section of the watch. However wehen I moved all of the code in the case statement into its own sub the watch window behaved as i expected.
Not sure whats going on there, be refactoring the sub made things cleaner anyway.
|
|
|
|
|
Hi. Which type of dialog box can I use to show an information message while the code is running behind? The MessageBox stops the execution until the user press ok button.
I have a long process in an application, but can't use a progress bar because the process is called from just one code line that calls a dll method.
Regards,
Diego F.
|
|
|
|
|
You probably want to research the BackgroundWorker object. It allows you to run code on a new thread.
---------------------------------------------------
Play Nation States and join The Code Project region with the password: byalmightybob
|
|
|
|
|
I'm not sure about how to use that object.
I have a call to a process that takes a long time and I want to show an animated gif while that process is running.
Should I put in the DoWork method the code that takes long time or the code that shows the animated gif?
Regards,
Diego F.
|
|
|
|
|
You will want to put the code that takes a long time in the DoWork event. However, it's a little tricky because when you run something on a different thread you can't just use class level variables or you will get a cross threading error. Parms have to be passed in through the background worker's argument property. It's too much to explain on the forums but I'm sure there are some articles on using the background worker...
Here is one: http://www.codeproject.com/csharp/backgroundworker.asp[^]
Here is another: http://www.codeproject.com/cs/threads/ImprovedThreading.asp[^]
Hope this helps.
--------------------------------------------------
Play Nation States and join The Code Project region with the password: byalmightybob
|
|
|
|
|
I've been testing with that object. Is there any way to stop the execution until the second thread finish? I need that process to finish to avoid some errors.
Regards,
Diego F.
|
|
|
|
|
Yes. If you have code that needs to run only AFTER the background worker has finished you put that code in the RunWorkerCompleted event of the background worker control. This event fires once the background worker has completed it's code.
--------------------------------------------------
Play Nation States and join The Code Project region with the password: byalmightybob
|
|
|
|
|
I can't do that, because the code needs access to main thread variables.
Regards,
Diego F.
|
|
|
|
|
Now I have the next problem
The combobox is placed on a tabcontrol and a tabpage that is not visible.
The combobox is databound
I set the selectedvalue to a existing value, but after selecting the tabpage the combobox is not set to that item.
If the tabpage is visible then it works fine.
Any suggestions ?
|
|
|
|
|
Your question doesn't make sense. How can you select a tabpage that isn't visible? Could you please provide more information about what you are doing and how you want the program to work? You may want to check if there is code for loading the tab page which may clear the combobox selection.
----------------------------------------------------------------
Play Nation States and join The Code Project region with the password: byalmightybob
|
|
|
|
|
Sorry
The combobox is placed in a usercontrol wich is placed on a tabpage.
By clicking on a button that is placed outside the tabcontrol, al the tabpages have to fill with the correct data. on that moment the first tabpage is visible (selected) tabpage 2 an 3 are not visible
the comboboxes in my usercontrol on tabpage 1 are filled correct, but those on the other tabpages are filled but the item I selected with selectedvalue are not shown
If I reload the form and select the second tabpage before cliking on the same button then the combobox on the second tabpage is ok, but the combobox on the first tabpage not.
I hope this is a better explanation
thx
|
|
|
|