|
Hi
You should use System.Timers.Timer or System.Threading.Timer instead of the System.Windows.Forms.Timer .
The System.Windows.Forms.Timer requires a MessageLoop in order to work. and the others will work without a MessageLoop
greets
M@u
|
|
|
|
|
Here is basically the only way I have been able to get the timer to fire correctly in Windows Service:
Class level variable:
Private coTimer As New System.Timers.Timer(10000)
Add a handler in "OnStart" event to the timer's elapsed event and enable it:
<br />
Protected Overrides Sub OnStart(ByVal args() As String)<br />
AddHandler coTimer.Elapsed, AddressOf coTimer_Elapsed<br />
coTimer.Enabled = True<br />
EventLog.WriteEntry("MyService Started")<br />
End Sub
Subroutine to take advantage of the timer:
<br />
Private Sub coTimer_Elapsed(ByVal pSender As Object, ByVal pArgs As System.Timers.ElapsedEventArgs)<br />
EventLog.WriteEntry("Timer Fired!")<br />
End Sub
That should do the job for you.
Pete Soheil
DigiOz Multimedia
http://www.digioz.com
|
|
|
|
|
hi all
thnaks for previous reply
One more thing I want to ask u guys.it must be silly que.Actually I am working in vb.net2003
in my one application breakpoits works properly.but in another application ,when i debug application one quemark appear on break pt.& it does not work at all.I do't know wt happend.Can any one help me.
thanks in advance
poonam
|
|
|
|
|
Hi Poonam,
I tried to reproduce the said behavior at my end. Unfortunately, I was not able to do so. I would suggest you to please try repairing the Visual Studio, it might be possible that IDE has been corrupted.
I hope this helps.
Regards,
John Adams
ComponentOne LLC
|
|
|
|
|
hi Poonam,
Please check you are not debugging the application in Realease mode. If you want to debug an application it must be running in debug mode and not in Release mode.
Regards,
Nilesh Hapse
|
|
|
|
|
hi nilesh
plz tell me hw i know application running in debug or release mode.& hw i solve the problem.
thanks for reply
poonam
|
|
|
|
|
Hii,
Presently , i am using a property in propertygrid of type Image class to add an image to picturebox at runtime .It is showing the image . No
Problem .
Now , i am not able to get the selected image path as string . I have to save the image path, but it is returning
If Not CType(ctr, PictureBox).Image Is Nothing Then<br />
Dim filePath As String = CType(ctr, PictureBox).Image.ToString()<br />
as "System.Drawing.Bitmap"
if i use imagelocation it is returning as null exception. ' i dont want to use this one
Here, i want to get like this "C:\Documents and Settings\sriram\My Documents\My Pictures\cp.Jpg"
Thanks ,
DVS
|
|
|
|
|
Hello,
You can use the ImageLocation property to retrieve the image path. However, you will have to
use the load() method of the Picture box to get the image in the box.
Lets say you have one picture box and two buttons. First button is used to browse for images and
second button is used to retrieve the image path. In this case, you can try the following code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click<br />
<br />
Dim ofd As New OpenFileDialog<br />
ofd.Filter = "JPG|*.jpg|BMP|*.BMP|All Files|*.*"<br />
<br />
Dim result As DialogResult<br />
result = ofd.ShowDialog<br />
<br />
If result = Windows.Forms.DialogResult.OK Then<br />
<br />
Me.PictureBox1.Load(ofd.FileName)<br />
<br />
End If<br />
<br />
End Sub<br />
<br />
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click<br />
<br />
MsgBox(Me.PictureBox1.ImageLocation)<br />
<br />
<br />
End Sub
I hope this will help. If you have any doubts, please reply to this thread.
Regards,
Allen
Allen Smith
Software Engineer
ComponentOne LLC
www.componentone.com
|
|
|
|
|
Well Thanks For the reply ,
I dont want in this way . I want in a way like if we select an image property of image type in propertygrid ,then we can select an image at any location and if we click button ok , the image wil be loaded in to the picturebox .In propertygrid it is showing as "System.drawimg.bitmap" without showing the image path .
Or in any way i want the file path . Actually i didnt find any method to get the selected image path in VS2005 or 2003 .Like the one in File Dialog ("FileName")
I want here the file path .
I Really needed it
DVS
|
|
|
|
|
hi,
is there tool do as button.preformclick in label ?
|
|
|
|
|
break_day wrote: is there tool do as button.preformclick in label ?
???
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
No, there is no Label.PerformRead().
|
|
|
|
|
Although your question does invite ridicule, there is a way to do what you want.
1. Put the code that you want to run when you click the label in a separate sub.
2. call that sub in the click event of your label.
3. also call that sub in the VisibleChanged event of your label:
<br />
Private Sub Label1_VisibleChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Label1.VisibleChanged<br />
If Label1.Visible = True Then YourSub()<br />
End Sub
4. where you would have called label1.performclick (if it existed, which it doesn't), instead use:
<br />
Label1.Visible = false<br />
Label1.Visible = True<br />
A complete example:
<br />
Private Sub Label1_textChange()<br />
Label1.Text += "bla"<br />
End Sub<br />
<br />
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click<br />
Label1.Visible = False<br />
Label1.Visible = True<br />
End Sub<br />
<br />
Private Sub Label1_VisibleChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Label1.VisibleChanged<br />
If Label1.Visible = True Then Label1_textChange()<br />
End Sub<br />
P.S. the VisibleChanged event will also fire when your form loads, so you may want to clear it in the Form's Load event:
<br />
Private Sub YourForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
Label1.Text = ""<br />
End Sub<br />
Good luck,
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
Good morning all
i have a strange situation here,am using a thread to hide my splash screen and after the Splash screen i Display my login screen, and after the i validate the credentials against the database, i need to Close the login Box and show the Main Form(MDI),ok that works fine, but the Login box et stucked at my screen. here is the code where it supposed to close
Private Sub btnok_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnok.Click
Dim frmmain As New frmmain
Dim frmlogin As New frmLogin
Dim strusername = CStr(txtusername.Text.Trim)
Dim strPassword = CStr(txtpassword.Text.Trim)
Dim obj As New Admin_BLL.Clients
Dim bl As Boolean
Try
bl = obj.loginBLL(strusername, strPassword)
If bl = True Then
frmlogin.Close()
frmmain.Show()
Else
bl = False
End If
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
.
Please tell me whats wrong with code.
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
Vuyiswa wrote: CStr(txtusername.Text.Trim)
This is a waste of time, txtusername.text.trim is already a string
Vuyiswa wrote: Dim frmmain As New frmmain
This is your new 'main' form
Vuyiswa wrote: Dim frmlogin As New frmLogin
and this is a new 'login' form
Vuyiswa wrote: frmlogin.Close() frmmain.Show()
I'm not sure why showing a main form modelessly, which then immediately goes out of scope, works. But, creating a new login form and then closing it, will do nothing for the other login instance that is already visible elsewhere.
The use of CStr makes me think you've used VB6. You should avoid VB6 constructs, they are nasty, and you should buy a book on OO to help you learn your way past these sort of issues.
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 )
|
|
|
|
|
Good Morning Chris
Go Easy on i do buy books. i will not Convert string to String again, i know that a textbox, is already a string, so i trying to fool proof it, but thanks for the advice about that.
Thanks for the Advice
Thanks
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
You should also study the books you buy.
|
|
|
|
|
Thanks i will
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
Hi all,
I would like to enquire you guys about back and forward buttons (history) like what we have in internet explorers. You could never predict where the user's went previously, etc.. Does anyone know how to go about doing that (code-wise) or have any resource on the net that would be useful(I tried searching - they are all on previous entries instead of previous page)?
Any help would be appreciated. Thanks.
|
|
|
|
|
you want back and forward buttons in your windows app, but you think you can't know where the user was before ? Perhaps you need to explain better ?
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 )
|
|
|
|
|
Yes, ok I mean
here is an example:
I'm currently doing a contract and supplier system. So a user could move from one form to another a lot. Let's say for example I moved from vendor create form, to vendor view then to contract create. NOTE: so, now I'm at contract create form. I have two buttons (named button1 and button2), text are "<<" and ">>", now I want to be able to go to vendor view form when i clicked on the "<<" button.
I hope I managed to explain my doubt. Pardon for any vague explanation earlier on
Any help would be appreciated. Thanks.
|
|
|
|
|
|
dspandian
if you need help, Stop screaming, It seems that you dont manners and what sort of Questionis that?
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
it's impossible to help you if you don't give some details (what kind of report, what datasource, what generators do you want to use (Crystal Reports, ...))?
|
|
|
|
|
System Error &h800004005(-2147467259). Unspecified Error
and sometimes a different error message appears like this..
the instruction at "asdjn234 blah blah blah" referenced memory at "0.123434". Memory could not be read
anyone got an idea why am having this error?
its a project with an active reports am trying to compile..
..any help would be appreciated and thanks again in advance
|
|
|
|