Visual Logic Number/Loop?
Dec 1, 2009
A Visual Logic flowchart that requests a positive integer as input, and carries out the following steps:If the number is even, divide it by 2. Otherwise, multiply the number by 3, and add 1 to the result. Repeat this process with the resulting number, and continue repeating until the number 1 is reached.After the number 1 is reached, displayed how many iterations were required to reach the number 1. (Hint: a number is even if number Mod 2 = 0.)
View 5 Replies
ADVERTISEMENT
Aug 25, 2011
I need a small app that randomly shuffles a set of preloaded numbers. The shuffling will be visible on the screen and goes on continuously (looping) until a key is pressed and as soon as that happens it will show the winning number.Am using visual basics 2008 to develop the application but my problem is when i start the app and hit a key it will loop through my numbers on the text file and it will also display the event but if i hit a key to stop it will not stop..I was workin on the app but my problem is how to stop the loop and resume on the with a keypress. below is the app codes.
Dim Running As Boolean = False
Sub ReadAccounts()
Dim arr As New ArrayList
arr.Add("1366-665885-666-22650")[code]....
View 1 Replies
Aug 7, 2011
It's lacking of loop and I dont know how to fix it. The main problem is that not all the selected records are inserting/ed in the database. only the first checked checkbox inside my datagridview. I'll attached a picture for the viewers to easily understand my problem.
So,First,Here's my code:
For i As Integer = 0 To DataGridView1.Rows.Count - 1
If CBool(DataGridView1.Rows(i).Cells(0).Value) = True Then
command.Parameters.AddWithValue("@CONSO_PARENT_STOCKHOLD_CODE", DataGridView1.Rows(i).Cells(2).Value)
ParentDone = True
[code].....
View 3 Replies
Feb 3, 2011
I have an small physics toy application I am developing. It works fine except the particles will not push each other away, only pull towards, I debugged that sub going through it command by command and realised the value 'H' would not change, what ever it was set to during the first pass through the sub is what it kept, the only way to change this value is to manually set it i.e 'h = 1'. Once the calculation is redone on the 'H' value it resets to what it was previously, even though the x1,y1,x2,y2 are all different, thus meaning H should be different.
I think it is me that has made a mathematical mistake somewhere, but I cannot see where it is. I need a fresh pair of eyes to look over my work. Please let me know if you find anything.
[Code]...
View 1 Replies
Nov 29, 2009
How to send logic 1 to pin 3 in Visual Studio 2005. In Visual Basic 6.0 code is simpe: TXD 1, or TXD 0, but I don't know how to do this in Visual Basic 2005, that's important that is logic 1 on PIN 3 of RS232 (serial COM port).
View 8 Replies
Mar 2, 2011
i have a function to check if a number is in an array. and if its not in an array the function returns false.if it returns false i want to insert the number into the next slot of array3. here is the code i have so far.
[Code]...
View 1 Replies
Sep 3, 2010
The application uses ADO.NET to invoke sprocs for nearly every database operation. Some of these sprocs also contain a fair amount of domain logic. The data access logic for each domain entity resides in the domain class itself. ie, there is no decoupling between domain logic and data access logic. I'm looking to accomplish the following:
[Code]...
View 2 Replies
May 17, 2012
I am trying to loop number into something like this.
0
12
345
[code].....
View 7 Replies
Mar 2, 2010
i have the following code....
For Each dgvRow In bout_grid.Rows
vfile = dgvRow.Cells("FileName").Value
video.FileName = "D:ee" + vfile
[Code].....
but it plays only one video and than stops but i want that it should play every video in datagridview i.e bout_grid....i have tried
System.Threading.Thread.Sleep = vduration
View 3 Replies
Aug 15, 2011
im making a friend adder for teenspot and this is what i have. basically you click a button and it adds the person selected on the list, then you have to click it again to add the next one. the thing is i need to know how to loops this so it just keeps moving down the list adding people automatically
[Code]...
ive tried multiple times with do...loop and for..next and all that kinda stuff, but i still havent figured it out. what it does is, it only runs through the add me pages and never clicks confirm which is the second part. im kinda new to vb
View 1 Replies
Dec 28, 2011
I have a dataset which includes some numbers, I want to calculate the sum of the difference in the numbers how do I do this? For example my dataset looks like this:
[Code]...
View 2 Replies
Mar 4, 2009
Does anybody know how to count the number of iterations in a for-each loop? I want to have a variable inside the loop, returning the corresponding counter every time the loop iterat
View 5 Replies
Sep 29, 2010
learning about loops (still a beginner) in VB.net. I have got the below code and basically it is meant to stop the loop once it reaches a number above 20. Now, the problem is that it does stop after number 20 but the last number that is displayed in the list is always above 20..... how I can stop it showing the last number as above 20?
[Code]...
View 6 Replies
Dec 15, 2009
Looking for a bit of help here. I know my If...Then...ElseIf statement is somehow off, but not sure how. Could someone point me in the right direction? I know I am almost there but need a nudge in the right direction.
[Code]...
View 6 Replies
Jan 12, 2010
I have a button that searches through a binary file to bring up customer information with the following code:
[Code]...
My problem is, I need to create a variable which holds the record number, so that the record can be edited, and put back into the file at its previous location, how would I implement this? Not sure about the code.
View 3 Replies
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
Feb 10, 2009
Is there a way to loop words for a number of times (like i want to loop a word for only 10 times....How would I go by doing that?)
Quote:
Originally Posted by EXample Like I want to have a textbox and If i put 10 in the textbox It would loop the word ten times or is I put 20 in the textbox it would loop 20 times ..and ..etc...and ...etc...
View 11 Replies
Feb 21, 2010
I am using some arrays that are pre-filled and I am having a random number generated between 0-10. That random number will then go in to all 5 arrays and pull the item from that location. I think try to take the sentence that is generated into another string. Once that is complete I then go through the final array to pull all the sentences and concatenate them together.
Currently I've only been able to get 1 sentence to print out of 5...a fresh pair of eyes would prob see where I am going wrong...I've been at this for awhile and wouldn't mind some advice to where I am going wrong.
Public Class MainForm
Private Sub MainForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
[CODE]...
View 6 Replies
Oct 3, 2009
I am doing a Coin Toss program for school and I'm getting my butt kicked by this thing. The following are the instructions exactly as my instructor gave them:Use the random number generator (see the code below) to simulate a coin toss. First ask the user for the number of repetitions. Next, set up a For loop to execute that many times. Each time you enter the loop, call the random number next method. Assume that a random value <= 5 is considered a "Heads"; a value >5 is a "Tails". That is, if the random value is <= 5, add one to an accumulator named intNumHeads. If the random value is >5 add one to an accumulator named intNumTails. When the loop finished, output the number of heads and the number of tails in a text field with appropriate labels.Dim intRandom As New Random()Dim intNumber As IntegerintNumber = intRandom.Next(0, 9) In my application I have the click event of the "Flip Coin" button coded as follows:
Public
Class frmToss
Private Sub btnFlip_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
[code].....
View 11 Replies
Feb 16, 2009
I need a random number of 6 (1 ,6), and to loop it 3 times. I tried this but it gives me error for - if myRandom.next(1,6) Then:
Dim myRandom As Random()
For i As Integer = 1, 3
If myRandom.next(1, 6) Then
End If
Next
Also I need to know the code for putting a picture into a picture box.
View 4 Replies
Aug 13, 2009
What is the maximum number of executions in a while loop in VB.net that it will allow? Meaning, it is checking for a variable to equal some value, but that value never comes? How many times will it execute the code before it quits? Is there some way to set the maximum number of executions without terminating it programmatically?
View 5 Replies
May 23, 2011
I would just like the program to end itself. Application.Exit just keeps rolling me back in a loop.EDITED to Include Code::
[Code]...
View 2 Replies
Apr 9, 2012
I want to be able to reveal and then populate a certain number of labels. The inefficient way would be to SELECT CASE on the number of labels required and then populate these in turn. I am looking for something like this:
For i = 1 to RequiredNumOfLabels
Label & i.visible = true
Label & i.text = DataTable.Rows(i).Item(2)[code]......
is the problem as after the line is executed, lbl still equals nothing.The reasoning behind it is that I was trying to create an invoice generator in vb.net and I was hoping that this would be a simple way to do it - count the amount of items in the order, populate the labels with the names of the items, reveal that many labels.
View 2 Replies
Jun 25, 2012
I currently have these group of files I want to rename:
C:Users medinaDocuments estenviromentTestfolderfile1-1111.doc
C:Users medinaDocuments estenviromentTestfolderfile2-1111.doc
C:Users medinaDocuments estenviromentTestfolderfile3-1111.doc
C:Users medinaDocuments estenviromentTestfolderfile20-1111.doc
I have a text box on my form where a I would enter a string of text which will replace the '1111' to whatever the string is in the text box field.
So for example, On my app, in the text box field, I would enter 2222, then when I click on button1, it will rename file1-1111.doc to file1-2222.doc, file2-1111.doc to file2-2222.doc, etc.....
This is my VB code I currently have:
[Code]...
View 4 Replies
Mar 1, 2010
i have a for each loop i.e
[Code]...
if want that the loop stops while the player play a file until finished playback
View 1 Replies
Jul 12, 2009
How do you add an arbitrary number of controls to a form at run time? With indexed controls I could define the 'seed' control at design time and reference 'clones' of the 'seed' control at run time via the index. Now I must declare each additional instance of the control at run time then set each individual property that differs from the default for that control for each instance. Then I must add the newly declared control to the appropriate container controls collection. I'd like to do this in a loop but how can I get away from using a fixed control name in the declaration:
Dim controlname As New Control
I can't use a string that I can manipulate the contents of for controlname because it sees it as a double declaration. I can't use an array such as Control(index) for controlname. Dim Control(maxindex) As New Control doesn't work. Dim Control(maxindex) As Control works but any assignment based on this such as Control(indexvalue).Name = "ControlName" fails. It didn't address the issue of handling the declaration of new controls in a loop with some kind of variable name for the control.
View 1 Replies
Dec 8, 2009
I have already a Pretest loop that counts the number that the user inputs and displays a message. I need to change the Pretest loop code so it will count down instead of up from the number of times entered by the user.I have already coded this:
vb.net Public Class frmMain Private Sub btnExit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnExit.Click Me.Close()End Sub Private Sub txtNumTimes_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtNumTimes.KeyPress
[Code]...
View 2 Replies
Jun 18, 2009
I want to write an Excel macro to set print formats in all worksheets in a workbook. I don't think you can do this by grouping; it appears you have to do it in each individual worksheet. I want to be able to run a macro in any workbook to loop through all worksheets in the workbook and then select the first worksheet.
How do you have the macro determine how many worksheets there are and set the loop counter equal to that number?
View 5 Replies
Jul 2, 2009
I have a form with a textbox, a button and a label. If I put a number in the textbox this number shows in the label but after that the label start to countdown from that number to zero.
View 5 Replies
Mar 26, 2012
I would like to loop through a number of integers to display the higher number, I would not know the higher or the lower number. How could I compare them to pick the higher one.
View 9 Replies