Decimals Revert To 0?
Feb 18, 2010
I have a textbox that requires the user to input the value of the Value-Added Tax of that certain area. I tried testing 12.5%. The string is converted to decimal then divided by 100 so 12.5/100 = .125. But when the program writes the value to a file, 0 is writen. not .125
View 23 Replies
ADVERTISEMENT
May 19, 2010
Dim y as integer
dim x as double = 125 / 60
y = Convert.ToInt32(x) 'removes decimals
That method works, it removes all the numbers after the decimal.
But, how to check if the double contains a decimal and if it has it, remove all the numbers after it?
I have tested all the possible solutions i can think of, but I always run into a lot of errors
View 5 Replies
Dec 21, 2010
As my Christmas week side-project I thought I'd knock up a quick console app that I can run from the windows Start-up folder.
The application is going to delete some unwanted Global Corporate Desktop Icons (I like to run a clean desktop - is this common?) and Reset the Windows 7 Theme to my lovely Visual Studio 2010 graphics.
I have read the reasons why this shouldn't be done pro grammatically for the user but I feel this case is different as every morning I am manually deleting the icons and resetting the theme (policy is not stopping this - just reapplying it every morning) so I though this little side project could save me time in the long term.
I am deleting the Icons OK but I am struggling to set my theme ala:
Dim key As RegistryKey = My.Computer.Registry.CurrentUser.OpenSubKey("SoftwareMicrosoftWindowsCurrentVersionThemes", True)
[Code]....
This is setting the registry key correctly but not applying it. Ultimately I may try a simple Wallpaper Set but I would like to use the theme if possible!
View 1 Replies
Sep 28, 2010
I want to get the old state (lets say datagridview default state) of grid after sorting is done. How can I achive this.
View 1 Replies
May 28, 2011
i am making a revolutionary web browser called bolt and i have nearly finished it!
I would like to add settings but the problem is that when i restart the web browser settings revert to default i tought about saving them into an ini or dat file called setting
View 4 Replies
Feb 13, 2010
I have a code snippet that I want to run when the app is closing. So, I used FormCLosing event. But now i wanna place a confirmation message for exiting. Like, if the user clicks the Exit(X) button, there'll be a prompt, if he clicks NO, then the app will not close and revert to previous state. Now I find that hard to achieve using FormClosing event. because it'll get executed no matter what button the user clicks.
View 1 Replies
Jul 16, 2009
How do I revert a form including the controls back to a original state without closing the app? For example I got a picture box and 2 buttons in a form..
[Code]...
View 7 Replies
Mar 18, 2011
I need to get my label outputting the slope to only have 4 decimal digits. I have it set as single now
View 4 Replies
Apr 12, 2010
I made a change to a project and hve induced a major problem. I have warnings and errors now, but I can still debug the project with the "last successful build" Iwould like to just revert everything to that build but I can't find a way to eliminate the problems I induced or find a way to go to a earlier build. Hopefully I can get back to an earlier version or I will loose the entire project as I can no longer get to the designer.
View 5 Replies
Oct 22, 2010
If i wanted to know if a whole number is a multiple of 10 or not I know i can do for e.g
If VarWholeNumber MOD 10 = 1 Then
......
Endif
But if i have a whole number with format "0.00" how can i only check if the last 2 digits after the decimal is a mod of 10 regardless of what the whole number sides value is.
So something like
If VarWholeNumber's ".00" MOD 10 = 1 Then
.......
Endif
How could I could this?
View 4 Replies
Jun 13, 2011
i need it to look at the coloum in a datagrid and make the back colour red if over 1.6(in sql this field is saved as Varchar(10))but at the min, i have a value of 1.5 and it is making the back colour red
Dim cell As DataGridViewCell
Dim CellVar As Integer
For Each row As DataGridViewRow In Me.OEEGrid.Rows
cell = row.Cells("CD")
[code].....
View 3 Replies
Oct 1, 2011
i have three cells in a datagridview third cell gives the result of multiplying first and second cell.When i reload or populate this data from datatable into that datagridview value comes like 40.00. with two decimals. For example
58.00 -------->i need only 58
58.78--------->i need exact 58.78
The only problem is to remove the decimals if they are 0.
View 10 Replies
Aug 16, 2009
I am using two forms and the results from form 1 i want to show on form two.The results are in dB(decibel). I get a long result lile 142.1233344444 dB. I want this result be like this 142.12 dB. I use value _passedText to get value from form 1 and display it on form 2 textbox results.text
passedText = Value
Results.Text = Value
What should i do to round off it in vb.net 2008.
View 5 Replies
Apr 27, 2012
Is this the proper way to bring up an error if the user inputs more than 2 decimals. 'Not decCost = [0-9]*.[0-9]{0,2}
[Code]...
View 3 Replies
Oct 4, 2009
I'm trying to check for the number of decimals in a textbox, but I'm not very successful so far:[code]How can I correct my code to make it work? Or any other/better solutions?
View 2 Replies
Jun 13, 2012
I've used .NET for a long time now but I have come across something I haven't had to do before and I'm struggling to work it out. What I need to do is work with binary numbers and convert them to decimals and vice versa but not necessarily using even numbers e.g. I would like to represent a number between 0 and 2047 which can be represented with 11 binary digits. Plus I want to represent a second number between 0 and 500000 which can be represented with 19 binary digits, and a third number, fourth etc. Then I want to string the whole binary results together and split it in to sections of lets say 5 bits each and convert those back to decimal.
[Code]...
View 6 Replies
Dec 21, 2010
how do you detect how many decimals a decimal number has
View 10 Replies
Jul 11, 2011
The 4 decimal point to 2 decimal point in a listview.... here is the code for displaying the data from the database to listview.[code]...
View 1 Replies
Apr 8, 2010
Here's a silly question. I cannot believe I've spent so much time trying to figure it out. I have a textbox where I enter numbers, such as 12, 12.3, etc. I would like this data to display as 12.0000, 12.3000, etc. My line of code looks like this:
[Code]...
View 3 Replies
Feb 19, 2010
I was dividing a number from one textbox into another and when i tried something like 22 divided by 15 i just got one. Are listboxes not able to handle decimals?
View 8 Replies
Jan 29, 2009
How to set default two decimals place in the textbox?
View 1 Replies
Mar 16, 2012
I have only started programming in VB recently and I am not very good on the coding side. I have two values a and b. When I divide them, I want only the integer part to show up ignoring all the decimals and storing it into the variable c.
i.e.:
a = 24, b = 11
c = 2
Output: 2
View 3 Replies
Oct 25, 2010
When i add it up it doesn't add decimals.
Example: 12.5 + 1 = 13
I need it to be 13.5
Code:
Dim total As Integer
Dim counter As Integer
[CODE]...
View 3 Replies
May 29, 2010
VS 2010 check if a number contains decimals?
View 6 Replies
Sep 28, 2010
Tabpages: Using a button, how do I go from tabpage1 to tabpage2? I have it kind of sorted, only not: Button click tabpage1 send to back() or hide() tabpage2 show() The problem with this, is it does not actually turn the page, and the tabpage1 tab still shows at the top. Decimals: Epically basic, I guess. I have calculations that does, for example: 10/6 = 1.666666666667 How do I get it to say 1.667 only?
And Lastly, Graphs: I have a line graph. I have fixed series as a envelope for the variable series to sit in. Again, epically basic - How do I make a series that draws a line for a variable?
View 2 Replies
Apr 19, 2010
25, .10 and .5... I cant get it to add. All it will do when each button is hit for each ammount is display that amount. Very frustrating. Here is an example of my machine:
[Code]...
View 6 Replies
Feb 20, 2011
I have declared my variables As Decimal, and what I am struggling to do is to display these values to 2 decimal places in such a way so that they both appear on the same line of output. Here is the guts of the problem (noting I have two different versions of Console.Writeline...the second one does display on one line, but without two decimal places).
[Code]...
View 3 Replies
Feb 7, 2011
facing some problems to achieve what I want. I have this piece of code which is working fine. My problem is that I want to display the results of the Text Boxes 2, 5 and 8 with thousands separated by commas and only with two decimals separated by dot , e.g. 1,234,567.89. I tried using Format and other options but I was unable to get the correct result.
Public Class Form1
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
If Not IsNumeric(TextBox1.Text) Or (ComboBox1.Text = "" And ComboBox2.Text = "") Then
MsgBox("Valores inv�lidos ou defini��es incompletas", MsgBoxStyle.Information)
TextBox1.Text = ""
[Code]...
View 5 Replies
Jun 3, 2012
I'm having some difficulty formatting some of my strings, I can't see what's wrong unfortunately. I have various numbers, e.g. 100.023, 13488.323, etc in a datagridview column that I would like to be formatted so it looks like this: $123,456
Here's what I've tried so far (that isn't working):
row.Cells(1).Value = Format(row.Cells(1).Value, "{0:D0}") 'I've also tried using {0:C0}
row.Cells(1).Value = row.Cells(1).Value.ToString("$#,#")
'This one (above) comes up with an error saying it can't put an "##" in an Integer column, something like that anyway.
View 8 Replies
Mar 10, 2011
What is the function that replaces all commas with decimals? For e.g. 0,001 will be 0.001 and L0,001 will be L0.001
View 2 Replies