|
Hello, I am working on a VB.Net application, which is called from another application and accepts commandline arguments. I want to strict users from opening multiple instances, instead I want to load existing instance and run a particular form based on the command line argument.
I will appreciate if someone help me out.
Thanks
|
|
|
|
|
This will determine whether or not your program is already running :-
Function IsAlreadyRunning() as Boolean<br />
Dim currentProcess As Process = Process.GetCurrentProcess()<br />
Dim allProcesses() As Process = Process.GetProcessesByName(currentProcess.ProcessName)<br />
<br />
If allProcesses.Length > 1 Then<br />
Return True<br />
Else<br />
Return False<br />
End If<br />
End Function
Steve Jowett
-------------------------
Sometimes a man who deserves to be looked down upon because he is a fool, is only despised only because he is an 'I.T. Consultant'
|
|
|
|
|
Many thanks for your quick reply. Can you please guide me how to load/access a running instance of application and to call a form.
Thanks
Nas
|
|
|
|
|
Not sure of that myself. I would believe the only way is to pass a message to the program somehow.
I would look into using Windows Message Queues and have your calling program send a message to before a task and your receiving program listen out for the message and act accordingly when one is received.
Steve Jowett
-------------------------
Sometimes a man who deserves to be looked down upon because he is a fool, is only despised only because he is an 'I.T. Consultant'
|
|
|
|
|
I have no idea about Message Qeue, I would be very thankful if you could spare some time and help me out.
Thanks
|
|
|
|
|
Have a look at some of the articles of CodeProject CodeProject MSMQ articles[^]
Steve Jowett
-------------------------
Sometimes a man who deserves to be looked down upon because he is a fool, is only despised only because he is an 'I.T. Consultant'
|
|
|
|
|
research mutex - several projects here that show you how....
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous
|
|
|
|
|
How can i add Double Quotes ("") in VB.NET Message Box, i tried \" but its not working
For example: I want to display information as...
My name is Jats as My name "Jats"
Jats
|
|
|
|
|
try "" inside your literal string
so just a double quote would look like """"
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
"My name ""Jats"""
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
Thankx Guffa, it helped.
Jats
|
|
|
|
|
Hi Friends,
I need to check the LAN connection status by using vb.net 2003(web application).
for ex:
you can assume that 10 machines are connected with each other any one of the machine is disconnected for the LAN means I have to know the status of disconnected machine status and connected machine status.
Do the needful
Thanks in Advance,
Known Is Drop.Unknown Is Ocean
|
|
|
|
|
|
I created a "UserControl" with about 260 controls, about 70% of them are UserControls with about 3 windows forms such as TextBox, ComboBox and DateTimePicker (which I will call "simple usercontrols" from now on). These 260 controls are spread over 7 TabPages of a TabControl.
From a certain point of the development on, the IDE hasn't shown the simple usercontrols any more (except for one of the tabpages in which the controls are still visible).
- The code, which is created automatically by the windows form designer seems to contain all the needed code for the controls in the same way as before, as far as I can see.
- In the form designer, the simple usercontrols are still listed in the combo within the propery window. When I select a simple usercontrol via this combo, it is marked in the form designer (surrounded by this typical rectangle telling the size of the control) though it is still invisible.
- The executable is ok, i.e. the "simple usercontrols" are visible.
To get rid of the problem I tried the following: I went back to a version of my usercontrol which didn't have this problem, added a few further controls and the same problem occured again.
Does there exist an upper limit of controls a form disgner can handle?
If someone has a hint/an idea to solve the problem, that would be really great. - Thanks in advance,
Michael
Code is in VB.Net 2003 (7.1.6030), Visual Studio 2003 with hotfix KB937059 and SP1 KB918007; MS.Net Framework 1.1 (1.1.4322 SP1)
|
|
|
|
|
i migrated the vb project into that of the .net
for the statment
Me.Cursor = vbNormal i am getting error it is not accepting vbNormal..
how to resolve it...
C:\Inetpub\wwwroot\HSBC.NET\frmApplication.vb(3324): Value of type 'Microsoft.VisualBasic.FileAttribute' cannot be converted to 'System.Windows.Forms.Cursor'.
|
|
|
|
|
soniasan wrote: Cursor
Look at the documentation for <a href="http://msdn2.microsoft.com/en-us/library/system.windows.forms.control.cursor.aspx">Cursor</a>[<a href="http://msdn2.microsoft.com/en-us/library/system.windows.forms.control.cursor.aspx" target="_blank" title="New Window">^</a>] . What type does it say it accepts?
|
|
|
|
|
There is settings which configure your project with strict type conversion or normal (like in vb 6, as you know you can assign an integer variable a string value like "147" it works fine in that).
Go to solution explorer, right click on you project definition (not solution one) and open its property.
A widow will be opened and now click on compile option there will be a combobox for Option Strict change it to on.
This will strict you to assign valid values to particular variables.
|
|
|
|
|
Hi to all
i migrated the project into that of from vb to that of the .net window
based application.
but it gives me error on
following statment
Load(frmManualSearch)
please tell me how to resolve this.....
|
|
|
|
|
soniasan wrote: but it gives me error on
What does the error say?
|
|
|
|
|
C:\Inetpub\wwwroot\HSBC.NET\frmSupManualSearch.vb(582): 'frmOutBound_manual' is a type and cannot be used as an expression.
when statment is ...
Load(frmOutBound_manual)
where frmOutBound_manual is the name of the form....
|
|
|
|
|
soniasan wrote: where frmOutBound_manual is the name of the form....
Incorrect. frmOutBound_manual is the name of the class that represents the form. A class is a specific kind of "type" (e.g. enums, structs are also "types")
You need to provide an instance of the class. If you do not have an instance already that you want to use then you have to create an instance of the class.
To create an instance of the class use the New keyword. Something like this:
Dim myForm As frmOutBound_manual = New frmOutBound_Manual()
|
|
|
|
|
Imports EmailThread
'Imports System.Web.Mail
Imports System.Net.Mail
Public Class Email
Private Sender As MailAddress
Private Receipient As New MailAddressCollection
Private Subject As String
Private Server As String
Private Body As String
Private ServerPort As Integer
Private Priority As MailPriority
Private Credentials As System.Net.NetworkCredential
Private Smtp As SmtpClient
Private email As MailMessage
Private HtmlBody As Boolean
Private DelivNotification As New DeliveryNotificationOptions
Private ReplyTo As MailAddress
Private Cc As New MailAddressCollection
Private Attach As System.Net.Mail.AttachmentCollection
Public Sub SetSMTPClient(ByVal Host As String, ByVal Port As Integer _
, ByVal EnableSSL As Boolean)
Smtp = New SmtpClient
With Smtp
.Host = Host
.Port = Port
.EnableSsl = EnableSSL
End With
End Sub
Public Sub SetCredential(ByVal domain As String, ByVal Username As String _
, ByVal Password As String)
'we create new structure credential instance
Credentials = New Net.NetworkCredential
Credentials.Domain = domain
Credentials.UserName = Username
Credentials.Password = Password
End Sub
Public WriteOnly Property SetPriority()
Set(ByVal value)
Priority = value
End Set
End Property
Public WriteOnly Property SetReceipient()
Set(ByVal value)
Receipient.Add(value)
End Set
End Property
Public WriteOnly Property SetReplyTo()
Set(ByVal value)
ReplyTo = value
End Set
End Property
Public WriteOnly Property SetAttach()
Set(ByVal value)
Attach.Add(value)
End Set
End Property
Public WriteOnly Property SetCC()
Set(ByVal value)
Cc.Add(value)
End Set
End Property
Public WriteOnly Property Setfrom()
Set(ByVal value)
Sender = value
End Set
End Property
Public WriteOnly Property setSubject()
Set(ByVal value)
Subject = value
End Set
End Property
Public WriteOnly Property setSMTPServer()
Set(ByVal value)
Server = value
End Set
End Property
Public WriteOnly Property setBody()
Set(ByVal value)
Body = value
End Set
End Property
Public WriteOnly Property setServerPort()
Set(ByVal value)
ServerPort = value
End Set
End Property
Public Sub SendEmail()
' Attach = New Net.Mail.AttachmentCollection
Dim obj As Object
email = New MailMessage
With email
.From = Sender
For Each obj In Receipient
.To.Add(obj.ToString)
Next
.Subject = Subject
.IsBodyHtml = HtmlBody
.Priority = Priority
.DeliveryNotificationOptions = DelivNotification
.ReplyTo = ReplyTo
For Each obj In Cc
.CC.Add(obj.ToString)
Next
.Body = Body
'For Each obj In Attach
' .Attachments.Add(obj)
'Next
End With
obj = Nothing
With Smtp
.UseDefaultCredentials = True
' .Credentials = Credentials
'.DeliveryMethod = SmtpDeliveryMethod.Network
.EnableSsl = True
.Port = ServerPort
End With
Try
Smtp.Send(email)
Catch ex As Net.Mail.SmtpException
MsgBox(ex.ToString)
End Try
Smtp = Nothing
End Sub
End Class
Please any help
i keep getitng the error "Time out"
phatkin
|
|
|
|
|
Well i got it working now....Anybody want the code...ask me and leme paste it here...
it was quite simple and corrected my mistakes from dnzone
http://www.dnzone.com/forum/topic.asp?topic_id=284
am sooooo happy now..
phatkin
|
|
|
|
|
Hi ALL
i am migrating the vb application which con.tains the OCX Control
to that of the .net project i Choose Vb.Net
But when in .net i create maually aspx pages.
and i copy that class modules also...
but i am not getting that events.
How i will convert that OCX control into that of vb.net project so that i can access
the events......
waiting for your kind response.....
|
|
|
|
|
Make sure what application you want to develop.
Web application (web sites) cannot have ocx controls. I think you want to develop windows application and by mistake you have chosen web site/application because web sites/application will have aspx extension.
Just select language vb/c# and select Windows Application project (new project)
|
|
|
|