Calculating Bit Masks In VB?
Jan 7, 2009I am trying to figure out how bitmasks are calculated in vb... I have the following constants and their bit values:
[Code]...
I am trying to figure out how bitmasks are calculated in vb... I have the following constants and their bit values:
[Code]...
I am completing a project for varsity and have done a lot of research on this topic but I can't seem to find the solution that I need. I am using Visual Studio 2005 and .NET Version 2.0. Here is the formatting they want me to use for the Cost Price textbox:"In your form, it should not be possible for a user to enter a cost price of 123.456 nor $123.45 (since we work in Rands and we also dont want to store the $ symbol nor do want the user to type a decimal point or a comma). Make sure that the cost price field has the following format: R ###. ## (where a user only has to enter the numbers)."
View 5 RepliesIs there an easier way to test if a file system item is a directory than using bitmasks?I have this code in one of my applications (two second line is actually in a loop over folderItems but for simplicity assume the first element):[code]This works, but is there an easier way than using bitwise AND with 1000 (base 2)?
View 6 RepliesI have a databound Datagridview, and I have a column that is for phone numbers. How to I set up an input mask on that column so the user sees the phone number characters "() - " but when its time to update the database the information is just the numbers the user entered "##########"
View 3 RepliesI'm really new to VB. This is only the 3 app I've created, and I'm stuck.I need to code an app that displays total commission earned on sales at different levels. The commission percentage goes up as sales go up.
Should I write a If/else/else/else/else/then statement or something else?There are 5 different commission levels in the problem. I have my interface designed, but obviously that's the easy part.
I understand the basics of using VB.NET, what I don't understand is what I need to tell the computer to do. I'm supposed to create a subprogram to calculate the greatest common factor and another subprogram to reduce the fraction from the answers retrieved from the first subprogram. My teacher said something about using Mod to calculate it, and also attempted and failed to explain ByVal and ByRef parameters. I don't even know where to begin other than the parameters I have for each, and even those have a high chance of being completely wrong.[code]
View 1 RepliesI,ve completed a program for a debt solution agency that calculates the amount a client can afford to repay after all his deductions and general life costs, my proplam however is at the end when i have to display all the creditors on a proposal data grid that shows the amount and total months to repay all creditors and calculates the amounts as one of the creditors debt is paid up and that monthly installment is devided between the remaining creditors.
View 1 Repliesi have the code below and i want to calculate the next working day adding five days from today and it must not add weekends as a working day. this code currently adds weekends as well and i need it tofclaculate excluding weekends.
[Code]...
I have a project that I'm working on and we are basically creating a calculator to calculate area of a rectangle and area of a circle using one button. How do I code to allow the button to calculate both the area of the rectangle and the
View 16 RepliesCan someone help me figure out why my calculations do not come out right? I have many notes so it is easy to understand. The assignment is: "Create a windows app for the rental of a vehicle. User selects number of rental days up to 7 days. The user also 'can select one of three types of vehicles. Customer has a choice of filling the gas tank themselves,'or prepaying for a full tank of gas ($52). If vehicle will be driven by more than one driver, a multiple'driver cost of $22 per day will be added to the cost." [code]
View 4 RepliesThe interest is compounded monthly and these are sample inputs and output.
Input:
Monthly Deposit: 300
Annual rate: .05
[code].....
I am trying to use and display calculations from various text fields, however it is appending the values. I think it has to do with it being a String Variable and not a Value.. here is the code
Private Sub btnTransact_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTransact.Click
If rb1Deduct.Checked = True Then txtp1Amt.Text = (txtp1Amt.Text - txtTransact.Text)
[code].....
I have three GPS antennae on a boat. They are in fixed xyz positions relative to each other. For example:
[Code]....
I am working on this program that is suppose to display the patient's bill after they have selected a service at a dental lab. the problem I am having is that if the patient name is empty it gives me a message but it still shows the bill. Also I am having a problem with the code that will calculate the bill if a a patient choose more than one service. Here is my code below
P
ublic Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
[Code].....
I have probably not a unique issue but I can't seem to figure it out. I need to calculate a datagridview column after it a new row has been added to it. I am adding the row to the datasource and the row is added to the datagridview but how can I automate the two thing together by a single button click. IE: add the row (with a value)to the gridview and then calculate. I have this code but is doesn't work.
Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
Dim OwnerID As Integer
[code].....
I just want to calculate age from two datetimepicker tools. The label should display - "XX years XX months xx days old". I have succeeded in calculating with respect to time, but failing w.r.t date.
View 3 Replieshere is my problem. i have to enter two grades, each grade should be an integer between 0 and 100 inclusive. Calculate the average of the two grades. If the average is greater than or equal to 90, display "Grade is an A!". It goes down the line for "if average is _______, display " ______is a/n __!" I get the last part and I know how to figure an average...but i am not sure how to type it in code. He did an elseif example, but it wasn't with 2 numbers and didn't have to average anything. So I don't know how to write that code....is there anywhere to look to find it? Here is what I have so far.............
Module Module1
Sub Main()
Dim grade, sum, average As Double
[code].....
Using VB.NET write a program that can calculate the grade of a student based on his or her marks in five subjects as input according to the following rules:
Grade A: For average between 100 and 80 (inclusive)
Grade B: For average between 79 and 65 (inclusive)
Grade C: For average between 64 and 40 (inclusive)
[code].....
I have a listbox with two values, Current account and Deposit account.The current account has an interest rate of 7% and the deposit account 3%.I have 4 other textboxes. The boxes on the right is where the user inputs and the left side holds the value.
Account Type [ ] Listbox >>[Current account]
Deposit account
Investment Amount [ ] [ ]
Interest over a year [ ]
What I want for the Investment Amount is that if the user selects Current account, the amount invested will be automatically calculated with the 7% interest and the same for the deposit, calculation with 3% interest.And the Interest over a year textbox to show how much the interest will be over that year at the rate (whether its 7 or 3%)
I'm having some problems calculating the values for two diferent fiels of the datatable. it return " Object reference not set to an instance of an object"this is How I feed the datatable
Dim daProd As New SqlDataAdapter
Dim conProd As New SqlConnection
conProd = Connect()
Dim cmdProd, cmdSave As New SqlCommand
[code]....
is there a formula for this? for example how many elements would be in this?dim m3array(5,4,1) as integer
View 4 RepliesBasically I have 4 empty textboxes. I need to calculate the total and averages of the numbers entered in them. So far, I've declared 4 variables and made it equal to the text that was input by the user. I'm stuck with the calculations tough. The user doesn't have to use all 4 boxes. So if he/she only entered 2 numbers, the total is divided by 2, not by 4 for the average. I think I'm supposed to use a for... next loop because the maximum iterations I should do is 4, but I'm not sure how to the code even if it is supposed to use a for loop. Otherwise, the rest of my project seems to work fine.
View 5 Repliesif i have two variables,
Dim Hours
Dim Minutes
what i want to do is add the minutes to hours, so if Hours =2, and minutes = 120 I want to say hours = hours+2, not so simple as it seems or am i missing something?
Dim hours
Dim mins
IF mins > 60
[code]....
how can i calculate the 13 points on the polygon (see image)?
the 2 points either side of the centre points
are +/- width or height * 0.2761423749154
i have 4 known points, topLeft, topRight, bottomRight, + bottomLeft.
the polygon won't always be a regular rectangle as it is in the image
How can I accurately measure the size of a portion of text within a label? For example, I'm trying to remove the first character from a fixed-sized label and find out the exact width of just the character I removed. I've tried the MeasureString method but it's not very accurate.
View 9 RepliesThe idea of this program is to calculate and find total and average for 3 Students automatically. That is when the first data is entered and click on button the total and average of first student should be displayed in listbox. And we should be able to enter second data. Bu the problem is it is just printing the first average and total thrice.
Dim a As String
Dim tot, avg, N As Single
Dim I As Integer
For I = 1 To 3
tot = Val(TextBox2.Text) + Val(TextBox3.Text) + Val(TextBox4.Text) + Val(TextBox5.Text) + Val(TextBox6.Text)
[Code] .....
Im trying to calculate TextBox values, but asnwer = 0. I think strings are too big/long.
Example : TextBox1.Text is 0.2777777777 and TextBox2.text = 60
TextBox3.text = Val(TextBox1.Text) * Val(TextBox2.text)
then TextBox3 Text is 0.
I have a GridView with column Percentage. I want to get the total of Percentages in that colum.
View 1 RepliesI have yet another question. I have set up a series of radioButtons to create a menu of choice for a class project and am trying to set it up so that there would hypothetically be a discount on a purchase of two or more t-shirts, I have the coding set up so that if any one item is checked and the calculate button is clicked, then the dollar value or "total" will show up, however I am not able to set up a total for more that one item, it clears the previous "total" and sets up a new total for the most recent t-shirt value checked.
[Code]...
[code]i need to calculate the item on my datagrid(gallon_qty) but im receiving the error when running it
View 1 Replies