Why Are Numeric Values -1 And 0 Used To Represent Logical Values TRUE And FALSE

Mar 11, 2010

I'm not sure this is really the right place for this question but I couldn't find a general programming forum.Why are the numeric values -1 and 0 used to represent the logical values TRUE and FALSE?

View 6 Replies


ADVERTISEMENT

Color Coding True Values In A Logical Test?

Apr 23, 2010

Can I set up a change in the font color when a certain true value comes up with a logical test - e.g. If the "value_if_true" says STOP, can I have the STOP show up in a red font and if the "value_if_false" says OK, then leave it as a black font?

View 1 Replies

Getting Inputs Values To Display True Or False?

Nov 18, 2011

I have several text boxes that I will input answers into and I want them to catch the values if they are incorrect or correct.

Example: the user will input a Letter for the answer, A or a, and I was curious to how the correct input can detect if the answer is correct.If the answer is A B C or D then no message should display but when it's some other value this message will come up.How do I use true or false in this code?

Dim dbl1 As Double
dbl1 = CDbl(txt1.Text)
If dbl1 Not 'A OR a' Then
'Display message
MessageBox.Show("Enter A, B, C, or D")

View 36 Replies

Reading Values From A Database 0/1 False/true To Populate The Checkbox ?

Mar 20, 2012

I am reading values from a database 0/1 false/true to populate the checkbox .The databse field is 'PPorCollect'. How can i figure out why the checkbox is not populating ?

OpenSQLConnection()
Dim mcommand As New SqlClient.SqlCommand("up_loadOrderID", conn)
mcommand.CommandType = CommandType.StoredProcedure[code]....

I populated a textbox with the value i was reading from the database.....Interesting the value is True/False not 0/1 like i was expecting...so i changed up the above code to the below code with no resolve....

Dim PPorCollect As Integer
PPorCollect = mReader("PPorCollect")
If PPorCollect = False Then[code]...........

View 6 Replies

Convert Numeric Value To Represent 0 To 1024

Nov 19, 2010

I am reading a pot that has a range of 1000 to -887.I need to convert that numeric value to represent 0 to 1024Where 1000=0 and -887 = 1024.

View 4 Replies

How To Add Up Numeric Values In Datagridview

Jun 22, 2010

I have a datagridview with 12 columns and 30 rows I want to use as a scoreboard for a game (no need to input or save data). Columns are for the players and rows for the scores of each turn played. Say player1 has a score of 10 I type it in in his column in row1, the 10 should show up in a label as his total. His next turn his score is 100, type it in row2 and the label should show 110 as total. Hope I am clear enough, is there anyone able to give an idea on how to do this (in code if possible)?

View 3 Replies

How To Modify Numeric Values In Row

Aug 28, 2009

If I have a column say "price" that has for arguments sake 800 rows and I want to use a textbox and button multiply every row by the number entered in the text box when I press the button. So lets say I want to raise the price 8.5% I'd put 0.085 hit the button it would loop through the rows and multiply each value in the "price" column accordingly.

View 38 Replies

Put Only Numeric Values In A Listbox

Oct 16, 2011

I need to put numeric values (only numeric, I should control that all numbers inserted are DOUBLE) and put in a listbox by the following criteria:

1-At the top
2-At the final
3-BY NUMERICAL ORDER (I tried to put it in Sorted=True but puts that 122 is lower than 22...)

How could I solve it? And how could I control that?

View 13 Replies

Rounding Numeric Values Up?

Mar 8, 2011

I need to round a single variable up to the nearest integer no matter what the decimal points are, weather it be 74.1 or 74.4 I always need it to round up to 75.ere is a sample of the code i am using

'Varibles
Dim sngLength As Single
Dim sngWidth As Single

[code]....

View 6 Replies

Use Numeric Values Only But Also Allow The Backspace?

Mar 31, 2011

I am using Visual Basic Express 2008.I have added the following code to my text box:

Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If Not IsNumeric(e.KeyChar) Then

[code]....

View 2 Replies

How To Get The Values From Datagrid By Status 'True'

Jul 22, 2010

I am using datagrid to display & edit the value by end user. If the user is edit the any row, status column set as true (newly added column to get the edited rows) its working. But now I dont know how to get the values from datagrid by status = "True".

View 1 Replies

10 Textboxes Numeric Values (SMALLEST)

Apr 26, 2012

if i have 10 textboxes on my form with numbers inside 5 of them have the number "0" other 5 lets say 100 50 40 30 10 i need to get the smallest value but not the "0".

View 2 Replies

Enter Numeric Values Into 2-nd Column And To Have Sum Of Value in Last Row

Jan 17, 2010

I have a datagridview with 2 columns.What i want is to enter numeric values into 2-nd column and to have the sum of this value in the last row (no matter how many values aka rows i will have). And also how can i have the last row fixed considering further actions.

View 10 Replies

Enter Numeric Values Into 2-nd Column And To Have The Sum Of This Value In The Last Row?

Jul 9, 2009

I have a datagridview with 2 columns.What i want is to enter numeric values into 2-nd column and to have the sum of this value in the last row (no matter how many values aka rows i will have). And also how can i have the last row fixed considering further actions.

View 3 Replies

[2008] Check In Another Event Whether The Values Has Been Set To True?

Feb 27, 2009

I'm testing with 2 buttons on form, at the form level i have set: Dim btnIsClicked As Boolean = False if a button is clicked in the click event i then set the boolean to true, but is there a way i can check in another event whether the values has been set to true?

View 4 Replies

.Net 2008 Sort DataGridViewTextBoxColumn Numeric Values?

Jan 27, 2012

I�m using VB.Net 2008 application program.I�m using DataGridView, where column types DataGridViewTextBoxColumn. I have 3 fields. 1 field values are numeric, 1 field values are string and 1 field values are decimal.

When I try to sort the string value column, it sorts correctly. But when i try to sort the numeric value column, it sorts as if its string value.

View 3 Replies

2008 : Sort DataGridViewTextBoxColumn Numeric Values?

Jan 27, 2012

I�m using VB.Net 2008 application program.I�m using DataGridView, where column types DataGridViewTextBoxColumn. I have 3 fields. 1 field values are numeric, 1 field values are string and 1 field values are decimal.When I try to sort the string value column, it sorts correctly. But when i try to sort the numeric value column, it sorts as if its string value.I searched a lot to make it sort numerically. But I couldn�t find it.

View 1 Replies

Add Multiple Numeric String Values In Linq?

May 11, 2012

I'm using Entity Framework code first and pulling some data back from our database. In the table I'm accessing is 13 columns that store the number of a items a customer purchased per week for the last 13 weeks as a char field. I have no control over how this data is stored. I need to total the 13 weeks results together to get a combined total, so take week1 + week2 + week3.... = Total Items Purchased over 13 weeks.In SQL I'd just Cast the char to an Integer and add the values together. But I'm struggling finding a solution to do this in linq.

I tried
(From c in Table
Select New With {.Usage = (Convert.ToInt32(c.week1) +

[code]......

View 1 Replies

Allow Only Numeric Values In Dataset Partial Class?

Aug 5, 2009

I have a textbox which is bounded to the typed dataset. If the user in the textbox &hit keydown, it should allow only numeric values with 2 decimal points and also it should not allow more than one "."(dot). I found many but all thats are using textbox event

View 2 Replies

Calling A Function To Validate Numeric Values?

Jun 7, 2012

The code below allows me to enter an integer in to the text boxes, but if I enter a decimal in any it throws an error. How do I validate decimal values in addition to integers?

Private Function numeric() As Boolean
'validate text boxes as numeric
Dim blnnumeric As Boolean = False

[Code]....

View 2 Replies

Cannot Read Numeric Values From Excel File

Sep 25, 2009

I am trying to read data with a test routine from a fairly simple 3rd party Excel file. The file has three sheets and was created by Open Office 3.x as an 'Excel 97/2000/XP .xls' file. The later, still to be programmed, application must later run on machines with Windows XP Professional using the 2.0 .net framework and no Office package installed. The content of the file does not need to be modified by the later application. For some reason, numeric values are not read correctly. They "convert" to DBNull. I've searched around a bit but not found a 'simple' solution for solving this problem. Adding 'IMEX=1' or 'HDR=Yes;IMEX=1' to the connection string results in an error 'Installierbares ISAM nicht gefunden' (installable ISAM not found).

Based on various examples I've found, I've written the following test code:
Option Strict On
Option Explicit On
Imports System.Data
Imports System.Data.OleDb
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
[Code] .....

View 2 Replies

Comparing Two Non-numeric Values - Selecting Lower In ASP.NET

Jan 19, 2012

I am updating an application I've written used by my employer, a University, to allow students to register for their desired residence hall. I'm working on a new feature that will allow students to "partner" with another student - so that when one or the other registers for a room, the other student will be registered as well.

[Code]...

View 3 Replies

How To Make Form That Allow To Enter Numeric Values Only

Sep 26, 2009

Dim number = TextBox1.Text
If number < 1 Or number > 100 Then
MessageBox.Show("You must enter a value between 1 and 100", "Name Entry Error", _
MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
Exit Sub
End If
Whenever I enter anything other than a numeric value; the form crashes.

View 14 Replies

Setting A Textbox To Only Accept Numeric Values?

Dec 9, 2010

I am looking into data validation as I need a way of setting a textbox to only accept numeric values. I have had a search for this and it doesn't seem as straight forward as I had hoped.

I have found a couple of possible methods, although the sites which I found them where very unclear on how they actually work. I feel strongly that I should know how all of my own programs work >_>

I have no actually got this to work with my program yet. Are there better methods than this?

Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
Dim allowedChars As String = "0123456789$,"

[Code].....

View 3 Replies

Sorting DataGridView TextBoxColumn Numeric Values

Jan 27, 2012

I am using VB.Net 2008 application program. I am using DataGridView, where column types DataGridView TextBoxColumn. I have 3 fields. 1 field values are numeric, 1 field values are string and 1 field values are decimal. When I try to sort the string value column, it sorts correctly. But when i try to sort the numeric value column, it sorts as if its string value.

View 3 Replies

VS 2005 Entering Numeric Values Using Combobox?

Apr 21, 2009

I would like the user to enter positive numbers (decimal or whole numbers but no fraction) using combobox. However the user can only enter the numbers using a number key pad built in the combobox. The number key pad will appear once the user click the down arrow of the combobox (I am not sure if there any predefined feature built into vb.net 2005 that has this property). The number key pad should contain the numbers 0-9 and decimal(.).

View 2 Replies

Unable To Select From Access Db In VB With Comparison Of Numeric Values

May 9, 2012

I am not being able to retrieve from my access database in vb. Here is my code that points to the problem:

[Code]...

The problem I have here seems to me that the comparison between is crop_year =? where ? is the placeholder for Convert.ToInt32(cyrNote.SelectedItem.Trim) which is a value i get from a combobox cyrNote and try to convert it to an integer using Convert.ToInt32() so that it can be compared with the database value crop_year which is defined as integer in the database.

The problem here though is that the select returns null. I tried to replace the placeholder ? with a known value like "2011" and it returned a value. This means to me that my comparison crop_year=Convert.ToInt32(cyrNote.SelectedItem.Trim) is negative yet I expect something positive. I've tried to google on how to convert to integer and that is the best I could get.

View 3 Replies

Parse Numeric Values In String Form Into Real Numbers?

Sep 14, 2009

I have a string I want to parse. I could write the code to do so, but I figured that VS.NET has a parser that should do this for me.however, I can't find it. All the searches I do return info on how to parse numeric values in string form into real numbers. It would be nice if the MSDN search had some ways to allow users to enter more details than just search text and 3 ways to filter out irrelevant stuff. In any case, I also tried things like string.parse (nope - although I kinda figured this would be it.) I also looked at Enum.parse, but the code indicates that it works with arrasy of items, not strings.

View 5 Replies

Sorting - Combobox - Auto-complete Behavior For Numeric Values?

Feb 21, 2012

I have a problem with the auto-complete behaviour of comboboxes in VB.NET (with the .NET framework 2.0).I am using a combobox to type in numeric values, and its DropDown list to suggest possible numeric values. This list is sorted in ascending order, for example {"10","92", "9000", "9001"}.The combobox properties are set as follow:

AutoCompleteMode: SuggestAppend
AutoCompleteSource: ListItems
DropDownStyle: DropDown
Sorted: False

The DropDown list is simply filled like this:

myCombobox.Items.Add("10")
myCombobox.Items.Add("92")
myCombobox.Items.Add("9000")
myCombobox.Items.Add("9001")

When I don't type anything, the order of values of the DropDown list is correct, in original/ascending order. However, when I start typing something, the suggested values in the DropDown list get sorted (alphanumerically): if I type "9", the list of suggestions becomes {"9000", "9001", "92"}.I would like to prevent this behaviour to get the values of the list in the original/ascending order. I can't figure out how...A possible work-around would be to pad with zeroes the values in the list, e.g. {"0010", "0092", "9000", "9001"} but I would like to avoid this.

[code]...

View 1 Replies

VS 2008 Read Csv File Into Dgv - Text Versus Numeric Values?

Oct 13, 2010

I read a csv file into my .net program using ado.net and display it in a datagridview.In the file I have two rows. The first column is a component id, and it is supposed to be numeric. But the user can edit the csv file before having my program load it, and accidentally put text there. That is something I want to edit when he presses a button to add the data to the database. So let's say he puts a value of A in the first record and a value of 1 in the second record. Or vice versa. What is displayed in the dgv is a blank in the first record and a 1 in the second, or 1 in first and blank in second. If both csv records are A, then what is displayed in the dgv is an A in both the first and second records. I don't understand what is happening. The fact that there sometimes is a numeric in the column makes it think it is a numeric field and therefore only display numerics and blank otherwise, and the fact that there's always text in the column makes the code know it is a text field?

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved