|
at timespan elapsed is giving me error
(i am using VB.Net for coding)
|
|
|
|
|
dim elapsed as timespan = date.now - start
should do it
If my help was helpfull let me know, if not let me know why.
The only way we learn is by making mistaks.
|
|
|
|
|
how to show the progress as well...
|
|
|
|
|
that would need a timer that ticks periodically (say every 100 msec) and updates the label
to show the difference between now and start.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
yup i have done that....
wat i need now is i want to display the time like continuously..... and after clicking hangup button it should show the total time it has taken to click the event.
|
|
|
|
|
so do it.
and if you need something new, read the relevant documentation and do some experiments.
And only if that does not help, ask a specific question on CodeProject...
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
That's because the code Christian posted is C#, not VB.NET. Though, it's easily translatable.
|
|
|
|
|
I am relatively new with programming and am having some issues with the following code. It is basically a calculator where I have 3 line of numbers in textboxes LINE1, LINE2 and LINE3. When I hit the + key on my keyboard it will add the first two numbers and displays the answer in the textbox LINE1. However it also shows “+” at the end of the result ie ”45+”. How do I show the result "45" without showing the key that has been pressed. Also happens when I use the other keys
as well. ( / * - )
Any help is appreciated
Thanks
Martin
Public Class HELP
Dim I As Integer = 1
Dim ANS, X, Y, Z As Double
Private Sub LINE1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles LINE1.KeyDown
If e.KeyCode = Keys.Add Then ' 3 values entered. 1 for each line and the plus key is pressed
If I = 1 Then
Z = CDbl(LINE3.Text)
End If
I = 2
X = CDbl(LINE1.Text)
Y = CDbl(LINE2.Text)
ANS = X + Y ' Addition of Line1 and Line2 as would a calculator
LINE1.Text = ANS
LINE1.SelectionStart = LINE1.Text.Length
LINE1.Select() ' Why is ther a plus sign at the end of the answer
LINE2.Text = LINE3.Text
LINE3.Text = ""
End If
End Sub
End Class
|
|
|
|
|
after you do your calculation put this on the next line:
e.handled = true 'this will handle the key, stopping its data being passed to the underlying control
so:
If e.KeyCode = Keys.Add Then ' 3 values entered. 1 for each line and the plus key is pressed<br />
If I = 1 Then<br />
Z = CDbl(LINE3.Text)<br />
End If<br />
I = 2<br />
X = CDbl(LINE1.Text)<br />
Y = CDbl(LINE2.Text)<br />
ANS = X + Y ' Addition of Line1 and Line2 as would a calculator<br />
LINE1.Text = ANS<br />
LINE1.SelectionStart = LINE1.Text.Length<br />
LINE1.Select() ' Why is ther a plus sign at the end of the answer<br />
LINE2.Text = LINE3.Text<br />
LINE3.Text = ""<br />
e.handled = true<br />
End If
|
|
|
|
|
Hi,
have a look at the KeyDown documentation...
from MSDN: Handled is implemented differently by different controls within Windows Forms.
For controls like TextBox which subclass native Win32 controls, it is interpreted to mean
that the key message should not be passed to the underlying native control. If you set
Handled to true on a TextBox, that control will not pass the key press events to the
underlying Win32 text box control, but it will still display the characters that the user typed.
If you want to prevent the current control from receiving a key press, use the SuppressKeyPress property
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
That was the answer thanks for your help
|
|
|
|
|
Hi Friends
Am in a bit of a pickle, and I now don't know how to fix this. I am trying to update the data in my dataset, and I am getting a concurrency violation. The application I am developing is to be used by, only one user, and there is no way that some one else could be using the dataset.
What could be the cause of this?
Thanks , I hope u will be able to help me.
|
|
|
|
|
Concurrency isn't just a multiuser issue. There are more than a couple of ways your own code can think it's updating records that it's not. The most common of which happens when your code goes to update a single record (such as when using the DataAdapter or TableAdapter), the number of affected records comes back 0 or greater than 1, because your table's primary key isn't setup properly, or if it doesn't even have one.
|
|
|
|
|
Hi, I got a problem when I try to get the value of numeric up down control. I have developed an application in vb2005 and contain a build in control numeric up down control. On the form i set the value of this control to 5 and in the code if i use the below code:
msgbox(numericupdown1.value)
the result in message box is 5. It is correct. But when I try the below code:
dim i as integer<br />
for i = 1 to numericupdown1.value<br />
listbox1.item.add(i)<br />
next
There is no value add into the listbox. I won't what is the problem? when I try to run the code in debugging mode, I found that numericupdown1.value=5D not equal to 5. So when the code reach the for next statement, it ignore and nothing happend. Does anyone know how could i solve this problem? Thank in advance.
|
|
|
|
|
did you check the type of NUD.Value?
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Luc Pattyn wrote: did you check the type of NUD.Value?
How?
|
|
|
|
|
by reading the documentation!
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
The Value property on a NumericUpdown control is a decimal (that's what the "D" indicates). Try casting it to an integer value before you use it in the for loop.
dim i as integer
dim max as integer
max = Convert.ToInt32(numericupdown1.value)
for i = 1 to max
listbox1.item.add(i)
next
|
|
|
|
|
Thank you very much for your help. I will try this code.
|
|
|
|
|
Kanel, this one was so easy to solve, it's silly. All you had to do was click on the Value part of the code you posted and hit <F1>. It's spelled out right in the docs what the return type is.
Even easier, you didn't even have to do that. After you typed numericupdown1 and hit the period key and started to type Value , Intellisense would have popped up and shown you right there what the return type is.
Public Proprty Value() As Decimal
Gets or sets the value assigned to the spin box (also known as an up-down control).
I know we keep beating this into everyone's head around here, read the documentation!! We do it for a reason. Rule number 1 in troublshooting: Verify, verify, verify. Verify that your using the correct types. Verify that the values you are putting in and using are what the object/method expects. Verify that you know, not assume, how the object works! The only way to do that is to read any and all documentation on the object.
|
|
|
|
|
What does the code below do??
Err.Clear
Set ts = fso.OpenTextFile("C:\userlevel\userlevel_billing.txt", 1, False, -2)
If Err.number = 0 Then user_level = user_level + 1
|
|
|
|
|
This belongs in the web dev forum, really. Why on earth would anyone be an asp beginner ? asp sucks.
The fso is the file system object created via COM. It can be called anything, but it's often called that.
Without even remembering the details, it's obvious to me that this code reads the text from a text file into a variable, and if no error occurs, the variable user_level is incremented. Google is the best place to find out what those options in the function call mean, but their lack of readability is one example of why asp is hideous.
Most people create const variables to contain the flags that things like 1 and -2 represent, in a vain attempt to make ASP code readable.
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
Hi
I programming a personal project, i would like about than how read a mp3 file from vb, but not only the header as i found many examples, else i would like read a mp3 file totaly to after i make others operations with him.
Thanks for help about how can know the mp3 structure, read the headers and load mp3 music section, greetings from mexico.
|
|
|
|
|
Hi. I am working on a form designer program in vb.net. The user will able to add, remove, and manipulate controls on a form.
I saw an article once about saving a form as a file (I believe it was XML), but I can't seem to find it. Can anyone help me find out how to save and load a form from a file?
Thanks,
Richard Faulkner
|
|
|
|
|
Have you done an article search here ( assuming you are meaning you saw the article here )?
"Find it your bloody self - immediately!" - Dave Kreskowiak
|
|
|
|