Creating Program To Display All Factors Of A Given Number?

Feb 9, 2011

I am working on a simple program to return all factors of a given input integer.nfortunately I am stuck. THe code is

Dim x As Integer
x = txtInput.Text
Dim factor As Integer

[code].....

View 4 Replies


ADVERTISEMENT

Creating A Program That Will Input A Number In A Textbox For Example 5 And Display 5 Textboxes In Form?

Sep 10, 2009

I'am creating a program that will input a number in a textbox for example 5 and display 5 textboxes in form...I have no idea how to do this but here is the code i've done..

textbox1.text = val(textbox1.text)

'i don't know what to do next..

View 1 Replies

Get The Prime Number From The User And Give Its Factors?

May 25, 2010

i wrote some code that is suppose to get the prime number from the user and give its factors but there's some error

Dim t As Double
Dim n As Double
Dim ans As Double
Dim exp1 As Double

[code].....

View 2 Replies

Creating A Program For Which Will Calculate The Time Taken For A User To Make A Number Keystrokes?

Feb 18, 2012

I am creating a program for which will calculate the time taken for a user to make a number keystrokes. I want to start the timer running from the beginning of the first key stroke and end on the final keystroke. Each keystroke has been linked to a label which will change colour according to whether the key has been pressed. When the keystrokes have been finished I want to save this timespan in a field in a database. To test that the timer is running I have made a messagebox which will show the time taken however it is constantly showing zero and the label for the final keystroke is remaining in the keydown colour.

Public Class Form1
Dim dteStart, dteFinish As Date
Dim span As TimeSpan

[code]....

View 19 Replies

Creating A Program That Will Display Upcoming Birthdays In Datagrid

Jun 9, 2010

Im creating a program that will display upcoming birthdays in datagrid. But im having problems in creating its query. I used DateTimePicker to input in Birth Date.

View 1 Replies

Creating An Program That Will Display Array Data To Datagridview?

Jun 28, 2011

Im a newby in creating programs using vb.net. Currently 'm creating an program that will display array data to datagridview. Can somebody help me how to do it?

View 3 Replies

ComboBox - Set Labels And Scale Multiplication Factors For XY Grid

Jun 28, 2010

I have some combo boxes that basically set labels and scale multiplication factors for an XY grid. The combo boxes themselves work as they should. Two adjust scale levels of the XY grid (label and multiplication factors) the other changes the Y axis units (Imperial/Metric). The issue comes when I try to replot old data... I have the data in the array and have confirmed it is accurate...but...

When I apply the appropriate value to combobox.selectedindex and then call the Sub that actually makes the scale changes, the selected index reverts to -1. Small Example.... (note consider all variables as public and all routines in a single class - ignore spelling - this is a quick subset recreation not a copy).

Private Sub ReloadGraph()
combobox1.selectedindex = LengthScale(GraphNumber)
Call LengthLabels()
PlotUnits = Units(GraphNumber)
Call UnitsSet()
[Code] .....

OK - so I did add some code..... I did not actually run this code, but this is essentially a snapshot of what fails....when I step through line by line, the selectedindex changes to -1 as soon as I step to the second line of the second 2 Subs BEFORE it processes the second line (i.e. always after I step off Private Sub xxx() ). Again, both UnitSet and LengthLabels work OK separately when called, it is ONLY when I set the selectedindex from a variable (and again, it DOES set OK) and then call these routines that the selectedindex goes to -1. I have read a bunch of stuff relating to selectedindex and selectedvalue resetting IF one or the other is blank, but I have tried setting both in testing and this fails too!!

View 9 Replies

CAI Program - Display Question "How Much Is _ X _?" With _ Being A Randomly Generated Number Between 0-9 - Label

Jan 28, 2011

Basically, I'm not sure if I'm thinking along the correct lines when trying to break this down. The program is supposed to display the question "How much is _ x _?" with _ being a randomly generated number between 0-9 which I have in a label. The student inputs the answer and clicks the "Answer" button. If he gets it right, the label below outputs "Very Good!" and automatically puts a new question in the above label. If the student gets it incorrect, the output is "No, Please try again." and the student keeps trying until the question is answered correctly.

My method of thinking on this is that the random.object generator is input first so the question with the numbers are output in the first label. Then, under the Sub answer.button, enter the statements that will either check and refer to the above statements to get a new question or have the student try again until it's answered correctly. One of the other criteria for this is that I have to use a function for the calculation. Would the function statement, because it has to return a value, go before the answer.button code or after?

View 8 Replies

Count The Number Of Affected Rows And Display The Number In A Messagebox?

Jan 8, 2012

how do i count the number of rows that are affected when I updated a table, and display the number of affected rows in a message box ??

here is my code for updating the table ...

For Each row As DataGridViewRow In DataGridView1.Rows
req = row.Cells(Column1.Name).Value
If row.Cells("Column1").Value = True Then

[Code].....

View 1 Replies

Generate A Random Number And Then Display That Number?

Nov 2, 2009

is there a way to generate a random number and then display that number?

like for example i want to say "i got # - # pencils" or something like that

View 6 Replies

VS 2005 Display Each Number Twice And Then Move On To Next Number

May 4, 2010

I am trying to run a nested loop; it should call a result from a MDB database. Which it does, when I run the single loop it goes thru all of the entries. But when I try to get a number to display twice it stops on the second entry. Having it display the number twice is just a test to make sure it does work, I am going to modify it after I can prove the loop works. The count on the Message Box is correct, but the number displayed is wrong?I want it to display each number twice and then move on to the next number. [code]

View 2 Replies

Program - Requests A High Number And A Low Number From User - Searches Array And Finds All Elements Within Two Numbers

Jan 24, 2010

I need to write a program that requests a high number and a low number from the user, then the program searches the array and finds all elements within the two numbers. The program is used to search for past presidents, so if I type 43 for low number and 44 for high number, the program will display:

George Walker Bush
Barack Hussein Obama

I think I have an idea of how to search up to a certain point, but not to stop at a certain point....Here is the code that I have for that particular sub procedure:

Quote:

Private Sub btnDisplayRqst_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDisplayRqst.Click
Dim sr As IO.StreamReader = IO.File.OpenText("PRESIDENTS.TXT")

[CODE]...

View 4 Replies

Creating A Number Base Converter?

Nov 3, 2009

Module Module1
Dim Bf, Bt, Lgt, Total, Pwr, Valu, Val2 As Integer
Dim InNum, Temp, OutNum As String

[code]....

I, will just explain a few areas of this to ease the process of understanding it:

1-The conversion Subs are to be used for values such as A7 in Hexadecimal

2-The Err Boolean will hopefully be used to link back to the top in the event of an error

3-Apollogies for the abreviated variable names, it simplifies things in my mind but winds my fellow students and teacher up no end.

This code is not fully functional yet, however I believe it should give an answer for my test value of 800 Base 10 to Base 8 (1440), however when the program runs in debug mode I can enter the three inputs but then it leaves two lines and gives an unresponsive flashing cursor.

View 3 Replies

Creating A Random Number Or Object?

Jan 23, 2010

I have an application with 6 cars 'racing' across the screen. Ideally I would like the random function to move only 1 of the 6 objects (cars) at one time and then loop until one car reaches a predefined finish line. However I'm not sure if this is achievable. Would I need to create a random number then create if statements?

View 8 Replies

Loop For Creating Number Of GroupBox

Dec 9, 2011

i have to create for loop that create each time a new GroupBox with new name and location this is not a homework.it is a personal Application to manage my information [code]i have to change the name of the first Dim in the loop each time , but i couldn't.

View 2 Replies

Creating A Word Table With A Different Number Of Columns In Each Row?

Sep 22, 2009

I'm working with Microsoft Word and trying to generate a table with headings that may span one to three columns. I'm having trouble figuring out how to do this. The table should look something like the following:Counters

Times (hrs)
Flows (gals)
Day
Regens
Well Starts

[Code]...

To get it to look this way, I'm not exactly sure what to do from VB.

View 1 Replies

Creating Sequential Consignment Number In Listbox?

May 22, 2010

I have built a system for a shipping company to use that takes user input from various sources (Textboxes, RadioButtons etc) and displays it in listboxes below. What I need to do is create individual shipping numbers for each of the consignments added based on certain criteria, that being:When adding a consignment, the system should generate the consignment number automatically in the format XY12-xAB, where x is a number that increases by 1 for each consignment, AB is the Shipment Type (EA, SA or SF) and XY12 is the Office ID.

So far, I have this:
Private Sub GenerateConsignnmentNumber()
Dim sConsignmentNumber As String

[code].....

View 2 Replies

Creating A Routine To Decode A 0-255 Number Into Specific Values?

Oct 22, 2011

This is kind of a brain twister. First, what it involves. I'm writing an application that is working with values sent to and received from an 8 bit micro-controller. There are 8 bits of specified values. Here they are. bit1 = 1, bit2 = 2, bit3 = 4, bit4 = 8, bit5 = 16, bit6 = 32, bit7 = 64 and bit8 = 128.I made a routine that uses 8 checkboxes to add the values for sending them to the micro-controller. That wasn't too hard. In my appp there are 8 checkboxes. Each checkbox assigns one of the specific bit values to a variable (or subtracts it when unchecked). The total of the variable is then displayed in a textbox and ready to send.Now the hard part that ed to take any number between 0 and 255 apart in values that will be a combination of the numbers (1,2,4,8,16,32,64,128) above and show each checkbox which is assigned those numbers to be checked.

View 6 Replies

Dynamically Creating An Unlimited Number Of Background Workers?

Sep 7, 2010

I am dynamically creating an unlimited number of background workers and would like to handle errors from them.

In a try statement I am using the following:

Catch ex As Exception
'Me.BeginInvoke(New UpdateTextCallback(AddressOf Error_Text), New Object() {Message, Account})
Exit Sub
End Try

I have commented out the BeginInvoke command because I can not get it to work. I get an error the the handle has not been created. This subroutine is in a module and I can not figure out how to get the invoke to work.

View 3 Replies

VS 2008 Creating Own Security For App / How To Get Unique Computer Id Number

Apr 16, 2010

I've seen threads on this topic posted before but they didn't come up in the search that I did. What's the best way to get a computer id code of some kind that is unique for each computer so I could use that to create a unique software activation code?Does Visual Basic have any staements that can give you this kind of information.

View 18 Replies

Randomizing Program - Making A Program Which Generates A Random Number Between 1 And 10

Oct 20, 2011

I am making a program which generates a random number between 1 and 10 and when 7 appears it is suppose to tell you how many tries it took to get the number 7 and then end the application. This is the code I have used:

CODE:

This code only generates the number 7 and exits the application, each time i click the random button but i want it to show the other number it randomizes too for example 1 2 3 4 .. etc, if u dont understand, please try it, but im trying to say, when i clikc random it just says number 7 (does randomizing in background) and tells you how much tries it took but i want it to show the other number it randomized also and when 7 appears, then exit the program

View 2 Replies

Creating A Backup Database To A Specified USB Flash Drive (Using Serial Number).

Apr 25, 2010

i have a question concering USB flash drives. I am building a Record Book with an Access 2007 database. When a user changes some information in the database i have built a procedure to create a backup of the database on a second hard drive. I was wondering if there is a way to find my USB flash drive serial number (either through coding or alternative ways) and specify that USB with that serial number as the location of the backup. As my program is at the moment, the backup is created from C to D. This can be a problem if on other computers there is no D drive or it's not a hard disk. By specifying the serial number to save the backup database to, should work on all pcs (theoretically). I am just not sure if this is possible in any way.

View 4 Replies

VS 2010 Creating A Shift Rota System For A Small Number

Dec 7, 2010

i am creating a shift rota system for a small number of staff basically there is a 3 week rota

week 1 - late
week 2 - early
week 3 - off

i am getting confused on how to calculate which week the member of staff is currently on eg week 1 / 2 / 3 i think i need a datediff with a mod to calculate it but thats where im getting confused (if im even right on that part)

View 3 Replies

Creating A Class That Searches A Binary File For A Specific Customer Number

Jan 4, 2012

I am creating a class that searches a binary file for a specific customer number. I am using a binary search that keeps on slicing the file in half until I find the customer number while is sorted. Once it finds it I am positioning it at the first instance of that Customer number as there can be multiple records with the same Cus Number.

Now here is my question. I now need to loop through this Customers records and do some data base searches. Since I want to make my class as generic as possible what should I pass back to the calling class? An Array with all their records. If I do this I have to loop twice, once in the class and once when it passes the array bac to the original calling class?

[Code]....

View 20 Replies

Creating VB Code To Increment The Number Of Fields In An SQL Create Table Statement

May 8, 2012

I have an SQL statement which i need to code in vb:

CODE:

Notice the fields prodno1 and prodno2 in the table structure.. this is part of a number of sql statements i need to run and put inside a loop. my problem is i want to automatically use this same code such that on the next loop, this sql statement is going to be:

CODE:

Note that in this "2nd loop"

- the table name is now r3 from r2 in the first SQL statement
- there are now prodno1, prodno2 and prodno3 instead of just prodno1 and prodno2
- in the WHERE clause, the p.prodNo becomes p.prodNo2

And so on and so forth.. so for the 3rd loop

- there's going to be r4
- there's going to be prodno4
- in the WHERE clause i will use p.prodNo3

View 3 Replies

Display A Number In A Message Box?

Apr 3, 2009

For some reason i keep getting an error whenver i try to display a number in a message box. If i write some simple code like this:Code:Private Sub btn1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn1.Click

[Code]...

View 3 Replies

Display The Number Of Lines?

Nov 2, 2010

Ive a richtextbox and want to display the number of lines it has in a separate RTB just like:

1 Hello
2 From
3 VB

I did it using the code:

<pre lang="x-vbnet">Private Sub text_RTB_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles text_RTB.TextChanged
numbering_RTB.Text = ""

[Code]....

View 10 Replies

Display The Week Number Only?

Apr 1, 2010

I am useing Visual Basic 2008 and on a form....

....how do i display the week Number only in a textbox or label

View 7 Replies

Creating An App That Will Display The Contents Of A Folder Containing Hundreds Of Other Folders?

Sep 29, 2009

i am creating an app that will display the contents of a folder containing hundreds of other folders. these folders are in the following format <Movie.Name>[<Year>]i am trying to create a function that will filter out the years i.e. if i wish to search for movies from 2009 i could use the code 'FilterMovies("2009")' etc... and remove/hide the others.

View 14 Replies

Creating File To Record And Display Best Score From Each Game?

Nov 2, 2010

To clarify - I'm building a simple game in visual basic and I'm trying to create a simple file to record and display the "Best Score" from each game. Actually there are four levels in this game (each one is on a different form) - I'm trying to save the best score from each level to display in a separate Game Stats form. Therefore I creating a datatable on one form, but then trying to get all my other forms to access it.

But now I get a new DBNull error message in part of code not of my making - NewGameDataSet.Designer.vb
Error Message = "The value for column 'BestScoreEasy' in table 'GameTable' is DBNull."
Does this mean I need another New Statement somewhere?

View 3 Replies







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