VS 2008 What The - Single Not Accurate
Aug 6, 2009Whats with this??the result of:CDbl(csng(35.8))is:35.799999237060547
View 2 RepliesWhats with this??the result of:CDbl(csng(35.8))is:35.799999237060547
View 2 Replieswhen i type the number in textbox3, why the number update to database not accurate ?
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim com As New OleDbCommand
Dim qty As Integer
Dim d As Integer = 0
[code]....
I am trying to use the DGV to view various properties from a variety of different class instances. Is it possible to bind each cell individually?
View 9 Replies why this code the number i add not expected what i want?
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim com As New OleDbCommand
Dim d As Integer
Dim qty1 As Integer
[code]....
I want to build a metronome,which sounds a beep in a specified time interval.The beep has to sound exactly the right time, after all, is a metronome.I need a timer that runs events(tick event)accurately.The timer control is not for this.
[Code]...
I set the value in VBT as 1.205, but if i print that value in Immediate window it get changed to 1.20492553710938. I need to display the value, whatever i have set.
what is the problem here and the solution to get the value whatever i have set?
Every sample code I've ever found for drawing rounded rectangles using GDI+ goes something like this (lifted and slightly modified from BobPowell.net):
Private Sub Panel1_Paint(ByVal sender As Object, ByVal e As PaintEventArgs) Handles Panel1.Paint
e.Graphics.Clear(SystemColors.Window)
e.Graphics.SmoothingMode = SmoothingMode.None
[code]....
This produces a rounded rectangle where only the top left corner is accurate.AntiAliasing has to be turned off because it is going through a remote desktop connection, and I can't depend on it being available. Besides, I am looking for a crisp rounded rectangle.I've tried resizing the other corners and changing the pen alignments, but nothing seems to produce a simple, accurate rounded rectangle.Is there a way to draw a better rounded rectangle than this in good old winforms?
I am currently using Decimal, thus far I have not checked thoroughly if it will have any inaccuracies so I wish to know from your experiences what is the best variable type for calculations, it would mainly be for areas.
View 10 Replieslook at this class and say why it's just returning just the first row in the second query, the issue is that the Salary is showing the right value when debugging, but when deployed to IIS it's just returning the 1st row
Imports System
Imports System.Collections
Imports System.ComponentModel
[Code].....
I'm using the code below to send large strings (500kB) to a server. I'd like to show the upload speed and in order to do that, I need to calculate the amount uploaded every second.
In a Timer that fires every second I get the BytesUploaded, divide it by 1024 in order to get KiloBytes (kB/s) and show it to the user. Then I set BytesUploaded to 0 and one second later do the same process.
The uploading is done asynchronously and the size of the data is added to BytesUploaded at once. This means that BytesUploaded is not being updated in a constant flow and has a totally different value almost every second.
0
512000
0
0
[Code].....
I'm creating a program (SURPRISE!), one of the features it has is a tutorial helping with learning a language which has a lot to do with the program's topic. So, I want the program to be capable of getting what the user inputs using his microphone (as a respond to a question the program asks), then analyze it and compare it to a prerecorded answer, then tell him how well he did. How to do that?
If this can't be done using VB.Net, which wouldn't be much of a surprise, then what programming language or whatever do you recommend for me to create an external .exe file which takes in the input, analyzes it, and returns the result to my program? (Isn't this the longest sentence in the English language!)Yeah, and, how can I control how accurate the program is while comparing them?
I have been trying to create a timer program with VB 2010 to the accuraccy of 0.05seconds (If possible, 0.01s)I insert a timer into the form (Timer1, Interval - 50).[code]But when I run the timer for 1min, the recorded time was 48.05 sec.How can I make my timer more accurate? Is there anything i have done wrongly with the code?
View 2 RepliesI am currently creating a program to send keystokes to a program at certain intervals. I need the thread to delay between keystrokes, and i need to be able to have the user input the amount of delay from the GUI via textbox. I have it running perfect with Thread.Sleep(), but it just isn't consistent enough. How can I code it to be accurate to roughly 5ms up or down? thanks, and here is the code. This is in VB 2010 by the way.
View 2 Repliesis it possible to draw an accurate circle in vb.net with mouseDown and mouseUp boundaries? I only manage to create circle-settings with rectangular boundaries using DrawEllipse. I've tried to work around it using pythagoras but it just doesn't work and I'm pretty sure I've got my maths right...
Is it possible to define a circle with DrawEllipse(pencil,x1,y1,width,length) ?
Say I have a code with 3 methods that do some pretty intensive work. Would executing these methods on 3 seperate threads be faster then executing them one after the other on a single core cpu? And what if it's a dual core or HT?
View 8 RepliesI am trying to make a list, separated by a comma, of entries from a single column in a SQL database. I have been spending the last several days searching for a way to do this, but every thing I found either didn't work, or wasn't exactly what I was looking for.
The query will pull all the email address that are not null. What I need to know is how to take the result of that query and make it look like this:
email0@address.com, email1@address.com, email2@address.com, etc, etc, ...
I feel like I should know this, but for the life of me, I can't remember nor can I find it in any of the textbooks I have.
I am using Visual Basic 2010 and SQL Server 2005. I also have access to Visual Basic 2005 if needed.
I use SqlParameters when executing database statements. I know that I can replace a single quote with two single quotes... but in the past SqlParameters took care of this for me. I have two projects.. in one, the SqlParameter does this and it handles single quotes fine, in another, it does not and I'm at a loss why (I even copied and pasted the code):
[Code]...
I am trying to update a row or a single cell in ms access through vb.net. But when i update the text box named NRIC, say for example i want to update "s4522147B" to "tr4521856C" and mean while leaving the other fields the same.
But the thing is when i make the changes in nric.text (textbox), the dataset actually updates the whole column in the table instead of the selected textbox.
Below is my code for the update part
[Code].....
I need an accurate timer to interface a Windows application to a piece of lab equipment.I used System.Timers.Timer() to create a timer that ticks every 10 msec, but this clock runs slow. For example 1000 ticks with an interval of 10 msec should take 10 wall-clock seconds, but it actually takes more like 20 wall-clock sec (on my PC). I am guessing this is because System.Timers.Timer() is an interval timer that is reset every time it elapses. Since it will always take some time between when the timer elapses and when it is reset (to another 10msec) the clock will run slow. This probably fine if the interval is large (seconds or minutes) but unacceptable for very short intervals.Is there a function on Windows that will trigger a procedure every time the system clock crosses a 10 msec (or whatever) boundary?
UPDATE: System.Timers.Timer() is extremely inaccurate for small intervals.I wrote a simple program that counted 10 seconds several ways:
Interval=1, Count=10000, Run time = 160 sec, msec per interval=16
Interval=10, Count=1000, Run time = 16 sec, msec per interval=15
Interval=100, Count=100, Run time = 11 sec, msec per interval=110
Interval=1000, Count=10, Run time = 10 sec, msec per interval=1000
It seems like System.Timers.Timer() cannot tick faster that about 15 msec, regardless of the interval setting.Note that none of these tests seemed to use any measurable CPU time, so the limit is not the CPU, just a .net limitation (bug?)For now I think I can live with an inaccurate timer that triggers a routine every 15 msec or so and the routine gets an accurate system time. Kinda strange, but...I also found a shareware product ZylTimer.NET that claims to be a much more accurate .net timer (resolution of 1-2 msec). This may be what I need. If there is one product there are likely others.
I have an assignment in which I have to generate random numbers and use arrays to count single digits. I've finished everything the random number part but am stumped for the digit counting. What expression would I have to use?
I've got my labels for the counters as lblZeros, lblOnes etc. but can't seem to get any further with the coding.
i have developed some applications using VB2008 but my biggest problem so far is how to create a single setup.exe file instead of having 3 files.. My applications do not depend on anything from my computer.. just using .NET FRAMEWORK 3.5 and objects from windows. Is there a program somewere to gather all three files into one?
View 6 Repliesthe datagridview seems more complicated the I thought it would be my problem is: how can I if I added three columns to my datagridview, let the program insert something with 2 variables and in the last column i would have to do some calculations with the column2 (like the sum of all rows in column2)
[Code]...
is it possible to force a DataGridView to be single row only?I cannot set the AllowUserToAddRows to false as i need one row.I cannot re size the grid to display a single row as i need the horizontal scollbar.
View 4 RepliesHow do I read a line from a database using WHERE? I've read this post but it doesn't really cover it and the forum search throws out the words, 'From' and 'Where' as being common. This is my bit of code but it just skips over it as if it doesn't exist so presumably there's an error, I dunno. I'm trying to read an entire line from the database where it equals the value of 'getweek' where 'getweek' is a variable.
[Code]....
Is it possible to compile my VB.NET project with a specific process name so that I can code to ensure that user cannot run multiple instance of the program?I have researched on the internet and found out most of them validate by process name. However, I have done a test which simply changing the exeuctable file to another name, the process name changes in the task manager as well. Thus, I don't think validating through process name works unless I can specifically assign a process name in the VB.NET project or validate through other ways?
View 3 RepliesI have a data table.
And I only want to have a single row in this table. I then write the changes to an xml file. The user will edit the row in this table save the values in the settings.properties. And then when ready write the changes to the config file.
However, I am thinking is there a better way. As I have to keep removing the row that was currently added. Then create a new one.
' Add the data to the datatable and write the changes to the config.xml file
Private Sub btnWriteConfig_Click(ByVal sender As Object, ByVal e As EventArgs)
' Only create a single row. All changes must be made to this row only.
[Code].....
I am developing a form which needed to display 2 values from a combo . I have table Account with these fields Account_type, Account_name in this table. Even though I am saving only the Account_type in to a new table but when selecting from the combo, I want the account_name also display since the account_type is a code so that user would understand the mening of the acount_type. vb.net code that would display both the code and the account name to this. I used data binding to do this, it also displayed only the code.
View 1 RepliesI am just starting to learn the visual basic language so i am trying to make a simple application where a user can put in it's first and last name or else the application exists.
I manage to do this fine untill i get to the point of ending one if statement and starting another in the same button..
(in the form i have button1, button2, label1, label2. Button2 is only a "quit" button)
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
[Code]....
What happens when i run this is that i can put in the first name but then when i click yes the application closes.
I am a new user. Apologies if I am posting this in wrong place and also if it is repeated one. I have few queries:
1.Is it possible to store multiple tables in a single DataSet?
2.If yes then it is a good practice? or should i prefer having separate connection object, separate DataAdapter and separate DataSet for each of the table to be accessed? I am new to VB.NET and using VB.NET 2008 Express and MS-Access 2007 as backend for my project.
A nice quick one I was wondering if anyone know the answer two (was shown a rough way to do this in vb6 but that was a long time ago)I have an application running in the system tray which I want as single instance (and currently have set as single instance)
However if someone double click on on the Desktop Icon or Startmenu Icon etc I want the main menu form to appear (frmMainMenu). Is it possible so that if opening the app when its already running triggers an invent in first instance rather than creating a new instance?