|
|
Does VB.Net has a timer function, I want to use a timer like:
timer.start();
do sth1
timer.now() in milliseonds
do sth2
timer.now() in milliseconds
d0 sth3
timer.now() in milliseconds.
Now I use Now() function, but I felt this function can't produce precise result.
And I googled stopwatch class, but it needs start(), stop() repeatedly.
modified 11-Apr-13 14:27pm.
|
|
|
|
|
econy wrote: And I googled stopwatch class, but it needs start(), stop() repeatedly. Not according to the manual;
You can query the properties Elapsed, ElapsedMilliseconds, and ElapsedTicks while the Stopwatch instance is running or stopped.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
The Stopwatch[^] doesn't need repeated calls to Start[^] and Stop[^]. At most, if you want to reset the elapsed time between readings, you would call the Restart[^] method.
Dim timer As Stopwatch = Stopwatch.StartNew()
do sth1
timer.ElapsedMilliseconds
timer.Restart()
do sth2
timer.ElapsedMilliseconds
timer.Restart()
do sth3
timer.ElapsedMilliseconds
timer.Stop()
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
What are you looking to do with this timer? Your post doesn't make any sense as "timer.now()" is meaningless. There is no "Now()" property or method on any of the Timer classes.
There are various types of timers in the .NET Framework, each is designed to handle different situations, but I don't think that's what you're trying to do.
If you're talking about starting a stopwatch and getting an elapsed time at various points in a process, then you use the Stopwatch class. To get your interval times, you just get the value in the Stopwatch.Elapsed, Stopwatch.EllapsedMilliseconds, or EllapsedTicks properties. You don't have to stop the stopwatch to do that.
|
|
|
|
|
Thanks, Now I understand the stopwatch class
|
|
|
|
|
I using ; 1 Textbox (for keyword), 1 Button (for Search Button), 1 ListView (Data List) and 1 label (for Result/Search information).
Thanks for help before
Best Regards
VB2010 Newbie
|
|
|
|
|
..and what have you tried upto now? Have you worked with a ListView before?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Hello,
I created an application for Windows CE 5.0 in VB. The class application AppCEClass is inherited from Microsoft.WindowsCE.Forms.MessageWindow. I have a problem to launch an application, because something like this does not work:
Public Shared Sub Main()
Application.Run(New AppCEClass())
End Sub
Windows does not recognize the class name and throw error AppCEClass() cannot be converted on System.Windows.Forms.Form.
What to do?
modified 11-Apr-13 9:22am.
|
|
|
|
|
I think your application should inherit from System.Windows.Forms.Form .
Use the best guess
|
|
|
|
|
yes, that's what I was trying to get across in the other thread by providing an example.
Re-WndProc-does-not-work-in-Windows-CE-5-0.aspx
"It's true that hard work never killed anyone. But I figure, why take the chance." - Ronald Reagan
That's what machines are for.
Got a problem?
Sleep on it.
|
|
|
|
|
I often wonder why some questioners make life so difficult for themselves, and go round and round in circle rather than accepting advice or guidance.
Use the best guess
|
|
|
|
|
> "I often wonder why some questioners make life so difficult for themselves, and go round and round in circle rather than accepting advice or guidance." <
Yes, it's like they're blinded by their own self belief that they are right, can't see at all. Even when they patently don't have a deep understanding of coding and won't admit it.
There's not much point continuing to help them, so I send them elsewhere.
"It's true that hard work never killed anyone. But I figure, why take the chance." - Ronald Reagan
That's what machines are for.
Got a problem?
Sleep on it.
|
|
|
|
|
I looked the following code in MSDN, but don't know how to test it. is onMouseDownClickcount() an event handler? then how can I link it to a control, ex: button?
The following example creates a MouseButtonEventHandler which determines if a single, double, or triple click occurred. ClickCount property is used to determine the number clicks.
private void OnMouseDownClickCount(object sender,
MouseButtonEventArgs e)
{
if (e.ClickCount == 1)
{
lblClickCount.Content = "Single Click";
}
if (e.ClickCount == 2)
{
lblClickCount.Content = "Double Click";
}
if (e.ClickCount > 3)
{
lblClickCount.Content = "Triple Click";
}
}
|
|
|
|
|
You found that here[^], didn't you? You ought to tell us the source.
It looks like an event handler for mouse events in a WPF application. Hence you cannot use it in a Windows Forms application.
|
|
|
|
|
yes, I found the code in MSDN website.
|
|
|
|
|
Hello,
I am doing program in VB for Windows CE 5.0. I need to catch messages from other programs in VB window. In VB is defined a function WndProc. But, this function does not work (or exist) on CE. Compiler cannot recognize it.
Protected Overrides Sub WndProc(ByRef recWinMessage As Microsoft.WindowsCE.Forms.Message)
MyBase.WndProc(recWinMessage)
End Sub
Can anyone help me?
|
|
|
|
|
You might be able to implement missing features using Library imports + P/Invoke
Look toward the end of this article. msdn.microsoft.com/en-us/library/aa446564.aspx
"It's true that hard work never killed anyone. But I figure, why take the chance." - Ronald Reagan
That's what machines are for.
Got a problem?
Sleep on it.
|
|
|
|
|
I tried to read an article, but I didn't find anything helpful. Problem is, that I am using VB for Windows CE and there is not supported WndProc. What can I do?
This is a fragment of code. What I am doing wrong? WndProc cannot be recognized od VB for Window CE.
<dllimport("coredll.dll", setlasterror:="True," charset:="CharSet.Auto)"> Private Shared Function FindWindow(ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr
End Function
<dllimport("coredll.dll", setlasterror:="True," charset:="CharSet.Auto)"> Private Shared Function SendMessage( _
ByVal hwnd As IntPtr, ByVal wMsg As Int32, ByVal wParam As Int32, ByVal lParam As Int32) As Int32
End Function
<dllimport("coredll.dll", setlasterror:="True)"> _
Private Shared Function SetWindowLong(ByVal hWnd As IntPtr, ByVal nIndex As Integer, ByVal dwNewLong As WndProc) As Integer
End Function
Public Shared Sub Main2()
Dim ip As IntPtr
ip = FindWindow(vbNullString, "Kvant 1.0")
If (ip <> 0) Then
MsgBox("Kuk!")
SendMessage(ip, &H10, 0, 0)
End If
End Sub
Dim GWL_WNDPROC As Long = -4
Dim lpPrevWndProc As Integer
Public Function SubClass(ByVal lHwnd As Long) As Boolean
Beep()
lpPrevWndProc = SetWindowLong(lHwnd, GWL_WNDPROC, AddressOf WndProc)
End Function
Protected Overrides Sub WndProc(ByRef recWinMessage As Microsoft.WindowsCE.Forms.Message)
MyBase.WndProc(recWinMessage)
End Sub
Shared Sub Main()
Application.Run(New AOutForm())
End Sub
|
|
|
|
|
Did you add the reference to Microsoft.WindowsCE.Forms in your project?
It is supported.
"It's true that hard work never killed anyone. But I figure, why take the chance." - Ronald Reagan
That's what machines are for.
Got a problem?
Sleep on it.
|
|
|
|
|
Yes. When I inherit class like this
Partial Public Class AOutForm
Inherits Microsoft.WindowsCE.Forms.MessageWindow
then WndProc works, but I have problem to launch application, because
Application.Run(New AOutForm())
does not work. What to do?
|
|
|
|
|
The VB My feature is supported in the compact framework. Perhaps that will simplify your efforts
msdn.microsoft.com/en-US/library/5btzf5yk(v=vs.80).aspx
I can't find any useful info about Application.Run with the current MSDN site.
So I keep having to switch to another machine that has most of the old Windows CE stuff.
Can you let me know any error codes that you receive, I will be able to look those up, on the other machine too.
"It's true that hard work never killed anyone. But I figure, why take the chance." - Ronald Reagan
That's what machines are for.
Got a problem?
Sleep on it.
|
|
|
|
|
How can I create a dialog Window in VB for CE. I mean something like DoModal() in C++. Sorry, I have just poor knowledge about this.
The error message what you are asking me for is:
Error 3 Value of type 'AOut.WNDMSG' cannot be converted to 'System.Windows.Forms.Form'. C:\Program Files\Measurement Computing\DAQFlex for Windows CE\Examples\VB\AOut\AOutForm.Common.vb 209 25 AOut
|
|
|
|
|
|
I know that example. I does not help me because my Window class is derived from Microsoft.WindowsCE.Forms.MessageWindow, not from System.Windows.Forms.Form.
|
|
|
|