|
Do you have some code sample or some link.
|
|
|
|
|
In order to detect already running instance of an existing application you may use following code in form load event-
--------------------------------------------
Dim ProgName As String = Diagnostics.Process.GetCurrentProcess.MainModule.ModuleName
Dim ProcName As String = System.IO.Path.GetFileNameWithoutExtension(ProgName)
If Process.GetProcessesByName(ProcName).Length > 1 Then
‘This will close the new instance of application
Application.Exit()
End If
---------------------------------------------
However in order to maximize currently running instance you will need to use a call back function in your application.
You may check following link for getting more information about cross-thread communication-
http://www.vbcity.com/forums/topic.asp?tid=112111
I hope this helps.
-Dave.
Dave Traister,
ComponentOne LLC.
www.componentone.com
|
|
|
|
|
Hi All
I am using a WebBrowser control to navigate to sites in my VB.Net application. After navigating I want to Navigate to some of the links in it depending on some conditions. Can anybody advise how can I collect the links contained in the WebBrowser Document and how can I Raise a click event for a collected link so that it automatically navigates to the link.
I have written the code as bellow :
Dim link1 As mshtml.HTMLLinkElement
link1 = WebBrowser1.Document.Links(10)
Now How can I click the link link1 to navigate to the link.
Please Help. Thanks in advance.
Sekhar
|
|
|
|
|
Hello every one
I have a variable which holds a color
grid_color.GREEN = System.Drawing.ColorTranslator.FromOle(&HC0FFC0)
I assign it to the back of a row of a grid
DataGridView_Payment.Rows(0).Cells(0).Style.BackColor = grid_color.GREEN
Now on different back colors I want to do different actions
But when I compare it again it dose not matches
If DataGrid_Q.CurrentCell.Style.BackColor = grid_color.GREEN Then
Can any one plz help me
|
|
|
|
|
Do the red, green and blue components match ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
When I do
DataGrid_Q.CurrentCell.Style.BackColor.ToArgb
then i get value as "0"
Can you plz give me a example of the same
|
|
|
|
|
The color is black, that's why it does not match.
DataGrid_Q.CurrentCell.Style.BackColor
in the debugger will expand to show the red, green and blue values, but it's already clear they do not match a green color. Therefore, your code is working, the cell is not green.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Thanks for the idea
Now it is working
The changes I made now are
- I was setting the color of whole of the row at a time
- When I was comparing I was comparing cell back color
- Now I changed the comparison to row back color and it worked
|
|
|
|
|
Great - glad it worked out for you.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi there all
i have a problem that want you all to solve for me
i need some code to list all printer name that shared on the network
and then i want to print some document by select a specific printer name.
pls save me i need very Urgent
Regard from
spider anatha
|
|
|
|
|
I'm sorry, but no-one is going to do your work for you, that's not what we do here. Printing a document to a printer whose name you know is easy enough. As for discovering printers, if the drivers are not installed locally, you can't use the printer over the network, all you can do is try to install it. And if it is installed locally, then you will have the name in your local list of printer names.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I am condemned for my sins to write in VB 6 for the next several whiles. Every time I fire up VS and select my project the IDE is populated with five modules I have absolutely no interest in seeing, editing, running, or anything else. I have closed them and saved the project more than once, but there they are the next time I start up.
Does anyone know where VS or VB saves whatever it is that makes these things appear?
Better yet, does anyone know how to make them stop appearing?
Thanx,
JimT
|
|
|
|
|
In the path that you save your project, delete all files whose extension is not as the known formats, e.g. if you have Form1.frm, then (if I remember correctly) Form1.frk or something like that is also created. Also one extra file is created with the name of your project, but without .vbw extension.
I can remember that if you delete these files, you would get what you want.
|
|
|
|
|
Thanks for your help. I tried it, but that didn't work either.
There were two files, as you suggested: .vbp and .vbw. I deleted the .vbw file and the annoying files quit appearing.
Thanks again!
JimT
modified on Tuesday, February 12, 2008 11:49 AM
|
|
|
|
|
I love the splitcontainer, but I need more than 2 panels. Any ideas of a good solution?
Thank you.
|
|
|
|
|
What about putting another SplitContainer inside one of the panels of the first SplitContainer?
|
|
|
|
|
Thank you.. yes, that is the way to go -- nest the splitcontainers inside each other.
|
|
|
|
|
Sorry, but I'm having trouble with what should be easy.
How to I detect that the user is holding down a key (F1 for instance) when the program first loads?
Thanks
|
|
|
|
|
Actually, it's quite difficult. Your application wasn't running when the key was pressed, so can't get a normal event notification that it was.
You'll have to use the Win32 API function GetAsynceKeyState[^] to find out if the key is still being held down. If I remember correctly, the virtual key code for "F1" is &H70.
|
|
|
|
|
Not hard at all actually... works perfect.. thanks!
|
|
|
|
|
Most people can't figure out how to do P/Invoke, let alone the binary math on the returned value. Glad to see you're not one of them!
|
|
|
|
|
It's much easier than that:
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal KeyVal As Integer) As Integer
then:
Dim t As Integer = Me.GetAsyncKeyState(&H71)
|
|
|
|
|
Hi,
I am making a application which is communicate with another application on the same system.
i use config file for the remoting cofiguration.And its worked fine for few minutes.
But after some times an error is occured when try to raise event to the client from server. Error is "Object '/313ea683_ade8_4edd_9b25_d5a9566a83b4/st61eu4jxpjjvhgy1ts4zuuk_1.rem' has been disconnected or does not exist at the server."
I already to the lease to Time.Span=0 and also try Nothing.
But same problem is occured.
At the same time client is properly responding i.e. client is able to raise event at server.
can any one soultion for the same.please help about this??????????
Complete error message is -->
System.Runtime.Remoting.RemotingException was caught
Message="Object '/313ea683_ade8_4edd_9b25_d5a9566a83b4/st61eu4jxpjjvhgy1ts4zuuk_1.rem' has been disconnected or does not exist at the server."
Source="mscorlib"
StackTrace:
Server stack trace:
at System.Runtime.Remoting.Channels.ChannelServices.CheckDisconnectedOrCreateWellKnownObject(IMessage msg)
at System.Runtime.Remoting.Channels.ChannelServices.DispatchMessage(IServerChannelSinkStack sinkStack, IMessage msg, IMessage& replyMsg)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at EventsManager.SharedClass.WrapperClass.WrapperClassMethod(Object sender, EventArguments e)
at EventsManager.SharedClass.Hoster.CallClientEvent(Object Server, EventArguments e) in D:\Nitin Jain\RnD\RemotingRnD\Currently Working on this\Reminder By Remoting Intregrated with PDA - 080207\prjRemotingClient\Remoting Shared Class\EventsManager\Hoster.vb:line 143
at PDA.ProspectDatabaseApplication.frmActivityEntry.SaveRecord() in D:\Nitin Jain\RnD\RemotingRnD\Currently Working on this\Reminder By Remoting Intregrated with PDA - 080207\PDA-Remoting Server\ProspectDatabaseApplication\frmActivityEntry.vb:line 2063
|
|
|
|
|
Hi
As far as i know every MarshalByRefObject proxy has a limited lifetime which is by default 5 minutes. if you call a method on the object, the lifetime is increased by 2 minutes.
so if you don't raise an event for 2 minutes on the client, the proxy that presents the client to the server will die.
you can solve the problem by
a) adding an ISponsor that keeps the proxy alive
b) setting the lifetime in the InitializeLifetimeService method and use a more appropriate initial lifetime for the client proxy.
greets
m@u
|
|
|
|
|
thanks for ur reply.
But i already override InitializeLifeTimeService and set initializetime to 0 or nothing
So i think object should alive for the life time.
And if proxy object is dead, than how client can raise event at server.
Please do me fever...
|
|
|
|