If/Then For Loop Code?

Feb 14, 2009

I'm having some trouble with a loop that I have to complete. I'll post the instructions and then the code that I have so far at the bottom:2. Start with the lower number.Display every other number starting with the lower number till you get to the higher number. Example if lowerNum = 5 and HighNum = 10 then it will display 5,6,7,8,9,103. If higher number is greater than 25, display every other number from lower number to 25. Example if lowerNum=20 and higherNum=30 it will display 20,21,22,23,24,25

View 2 Replies


ADVERTISEMENT

'For Each' Loop From This Code?

Jul 21, 2010

Dim Temp() As String, Result As String, HTMLCode As String

HTMLCode = t.Text
Temp = Split(HTMLCode, "/view/")
Temp = Split(Temp(1), "/")
Result = Temp(0)
l.Items.Add(Result)

I don't know how to make a for each loop for this code... What i need is to get the text between "/view/" and "/", which it already does. But it only results in 1 string. I need it to find all the lines that contain "/view/" and end with "/" and extract the text/numbers between them. How do I do that ?

View 7 Replies

How To Loop Through Code

Sep 10, 2010

I'm using the Following code in my project, but I cant seem to make it loop as its getting stuck if i specify more than the value of 1 in textbox5.Everything works in a single instance, all is checked to see if it already exists then either generates a new password/serial or commits to the database with the random serial/password

I've tried a few different methods to cycle this code based on the value in textbox5 but i cant seem to figure out whats stopping it working.

[Code]...

View 13 Replies

Code - Incrementing The Loop?

Aug 5, 2011

What is the += used in this code doing? Is that incrementing the loop?

Public Class Form1
02
Public Structure Family

[CODE]..........................

View 2 Replies

Loop Data At Code Behind ASP.NET ?

May 19, 2012

Currently, I am looking for a solution to makes my data loop at the code behind? It is actually an announcement list that query from database which contains the title and contents.

cmdDa = New SqlDataAdapter("SELECT * FROM announcement ORDER BY announcement_PostDT DESC", conn)
ds = New DataSet()
cmdDa.Fill(ds, "announcement")[code]....

Should I put it into a panel, list view or anything and loop it?

View 1 Replies

Evaluates Loop Condition In Do...Loop Statment To Determine Whether Loop Instructions Should Be Processed

Mar 14, 2011

Makes the following statement about the code below:

**"The computer evaluates the loop condition in the Do...Loop statment to determine whether the loop instructions should be processed. In this case, the inputsales <> String.Empty condition compares the contenst of the input sales variable to the String.Empty value. As you know the String.Empty value represents a zero length, or empty, string if the inputsales variable is empty, the loop condition evaluates to True and the computer process the loop instructions. *If on the other hand the inputsales variable is not empty, the loop condition evaluates to false and the computer skips over the loop instructions.

Based on the code I think it is the opposite: ...that while the inputsales value is not empty it should evaluate to true and process the loop and if it is empty it should evaluate to false and skip the loop?

See below.

Option Explicit On
Option Strict On

Imports System.Globalization

[CODE]...

View 2 Replies

Can't Get Loop To Work - ASP.NET | Dream.In.Code

Feb 21, 2010

I created this ASP.NET Web application and I can't get the amoritization table(MonthlyPaymentBox) to loop correctly. I think the problem is somehow in my code I am setting the TotalLoan = 0, but I just can't locate where that is happening. I assume this because instead of of starting the current balance at the users input, it starts at 0.

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="WebApplication1._Default" %>
<!DOCTYPE html PUBLIC "-W3CDTD XHTML 1.0 TransitionalEN" "http:www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

[code].....

View 4 Replies

Code For A For/next Loop That Will Retrieve A Particular Column?

Jun 30, 2009

I am trying to figure out how to write code for a for/next loop that will retrieve a particular column, or field to add the grand total of the objects located therein. This is what I have:

Private
Sub subCalculate()

'this sub is used to figure and list the total price of the selected category

Dim drArray() As DataRow
Dim pintCount As Integer
Dim pdecTotal As Decimal

[code]...

View 10 Replies

Creating Controls From Code In FOR NEXT Loop?

Nov 24, 2009

I'm creating 50 picbox in code. they are named Area1_1 to Area 1_50.

They all have different XY position and different size, setup in % of the form width.

Like this:

Code:
Dim Area1_1 As New PictureBox
' Dim 48 other box...
Dim Area1_50 As New PictureBox

[Code]....

But it don't work. Probably because the controls is not added to the form yet...

View 8 Replies

Loop Code In Visual Basic?

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

Looping Through Different Textboxes With One Loop Code

Jun 1, 2010

i know there are no "control arrays" in vb.net. i do come from vb6, and im trying my way now within bv.net, so please be gentel...

if someone could please post a simple code to do the following, it would be great:

i have 3 textboxes called txtBet1, txtBet2 and txtBet3.

i have another 3 texboxes called txtResult1, txtResult2, txtResult3.

so i want to have one loop code, to get the value in txtBet1, calculate somethings, and put it into txtResult1.text.

i know it's basic, but i tried using this sample here as a reference, but its not really understandable for me, because its not really choosing the exact control i want to address...

this is from Microsoft website - a comparison between vb6 and vb.net:

"' Visual Basic 6.0
Private Sub ClearText()
For i = 0 To Text1().UBound

[Code]....

View 5 Replies

Next Loop - Pseudo Code - Sum Only The Even Numbers

Feb 11, 2011

Write the pseudo code needed to sum only the even numbers from 1-n, where n is a value given to you by the user

And I have something like this:

Dim x as integer
n = txtUserNumber
For x = 1 to n Step 2
Total+= sumofnumbers
Next

View 4 Replies

Next Loop To Scrape Through Some Html Code?

Mar 25, 2010

I am using a for next loop to scrape through some html code. I am testing elements for a certain string, and when it hits that, I need to get the string that resides 2 elements earlier.When going through a for...next loop (I know you can loop completely backwards with step -1), is there a way to 'go back' 2 loops?
Ex)for each'lets say we are 5 loops in and our if returns true'can i go back to loop 3, perform an action, then return to loop 5 and continue the real loops?

View 6 Replies

VS 2010 Code Does Not Execute After For Each Next Loop

Oct 26, 2011

I am calling a sub from a form load event. The procedure that is being called adds columns to a listview and then loops through an array to populate the listview. I have another procedure called after the loop that does not execute when the loop completes. Please advise as to what I am doing wrong for the code not to execute after the loop in the if/then/else statement or why it is not executing if I remove the if/then/else statement and just placed the called sub after the loop or why the code does not go back to the form load event and then call the next called sub.[code]

View 9 Replies

WebBrowser Loop Code Not Working As It Should

Nov 30, 2008

Basically, what I'm doing is navigating to a website with a backgroundworker.In the WebBrowser1_DocumentCompleted event, I put code to fill in a form and I set the value of a boolean called "formFinished" to true once the form has been finished and submitted. The problem I'm having is that it only posts data to the second website, no matter the order of the websites. I'm wondering how this is possible since I have a boolean in state which only gets set to true once the first form has been submitted. So I have no clue as to why it only submits the second one, but not the first one.

[Code]...

View 1 Replies

Cannot Find The Proper Way To Write The Code Of A Loop?

Sep 26, 2010

that i can get a message box containing thitems who have the first letter i asked in a textbox , and the items are in a list box. So I repeat, i have alist box, i havetems in it, and i have a text boxupper that i wrote a letter in, and i want that when i click on the button under, it shows me the items in the list boxhat begin with the letter I enteredn the text box

View 1 Replies

Code Loop Based On CheckBox State?

Jan 20, 2011

I just want to repeat a code block if a CheckBox it's checked...So, i'm very novice to programing in Visual Basic and i'm learning by myself doing little things like a Ping Tool.I have this code:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Label1.Text = ""

[code].....

View 6 Replies

Loop Code For A List Of Radio Buttons?

Jan 28, 2010

I need help in finding out if there is a more efficient way of writing my code. The code below is a list of radio buttons all of which have different values for example

radiobutton1 has a value of 1
radiobutton25 has a value of 20
the values are stored in a variable called 'count'
the 'count' is incremented by the ammount from the radio button clicked.

Is there a way the radio buttons can be compressed into a for loop and if so how can i still access thier each values.

[Code]...

View 9 Replies

Loop In Search Engine Finder Code?

Jan 14, 2012

Ran into a problem. My for loop seems to stop after just for the task. I can't seem how to get it to continue on, I've used this type of loop many times and have never had this problem.

[Code]...

View 1 Replies

Change The Pretest Loop Code So It Will Count Down Instead Of Up From The Number?

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

Save The Information From Each Activation Of The Code Inside The Loop?

Jun 11, 2011

How do I save the information from each activation of the code inside the loop. I decided to try this a different way. I also need to know how to create colums in a label?

For countInteger As Integer = 0 To 3
seatsSoldInteger = ticketDetail(countInteger).seatsSoldInteger
costDecimal = ticketDetail(countInteger).costDecimal
totalTicketSalesDecimal = ticketDetail(countInteger).totalCostDecimal

[code].....

View 1 Replies

Section Of Code Causes Freezing, StreamWriter Inside For/Next Loop?

Nov 14, 2010

Dim tbox As Control
Dim oWrite As System.IO.StreamWriter
oWrite = IO.File.CreateText("c:Template.BBT")

[code]......

View 5 Replies

VS 2010 Repeat Loop/Code Check For Text,URL Etc?

Feb 22, 2012

I am waiting for a confirmation email to arrive within the web browser I am using I do not need to click any buttons to open this mail I just need some help figuring out how I can check whether it has arrived or not I already have the code to find the link and navigate to it (I had to navigate rather then invoke due to it trying to open in a new window outside of web browser and out of my control)

How can I keep checking for my specified element and when found carry out the rest of my code or is there another way I should be doing this the code I am using to find the verification link and navigate to it is as follows

[Code]...

I really am desperate for help on this one I have been reading about loops but cannot seem to find any example which I can use and change to my needs I have done so well in learning up until now and I have really hit a brick wall for something which seems so simple

View 2 Replies

Clean Up Code - Use A For...Next Loop So Can Fill A Text Box With Sequential Numbers

Sep 10, 2011

I've got Visual Studio 2010 and I am looking to clean up my code technique, since I've taught myself and now I'm taking classes.

I'm trying to use a For...Next Loop so that I can fill a text box with sequential numbers. For some reason, all I can get in the text box is the last number and I feel that at this point I'm probably overthinking it...

All I want is on the button push the text box shows:

Here's what I have:

CODE:

Once I grasp this simple concept, I can move on to the actual challenge ahead of me, but I really want to know the proper way to handle this with out going all spaghetti code.

View 7 Replies

VS 2008 - Infinite Loop - Event Triggered Keeps Firing Off The Code

May 9, 2010

I'm not even sure what I need to know. None the less lets say I got a timer with an if event to check if said event is triggered then it fires off some code. The problem is if said event is triggered it keeps firing off the code and I only need to do it one time. Whilst letting the timer keep checking if event happened. I hope I worded that right and here is a rough translation in code. [Code] Is there a way to keep checking if an event happened and only fire off the code one time?

View 1 Replies

Loop, Timer - Code That Checks That The Network Is Connected But Need It To Keep Checking And Updating

Feb 4, 2010

I am a new member that has just start coding. Im currently working on a small application for a desktop that will give me information from my system. I have code that works but might not be great. I have code that checks that the network is connected but need it to keep checking and updating. I Have tryed loops, goto and timers but not having any luck. Can anyone help point me in right direction. Here is my code so far.

Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Label1.Text = TimeOfDay
Label8.Text = "Time :"

[CODE].........................

View 2 Replies

Check If A String Exists In Html Code By Executing A For Loop Which Executes Each Time A Different Url?

Apr 4, 2012

I would like to know please how to check whether a string exists or not in a html code. I'm executing a for loop. Each time it checks a different url, so I want to be able to check each time if for example "<img" exists .

P.S: What's the difference between using

webrowser1.navigate

AND

dim request webrequest
request = WebRequest.Create
etc...

View 1 Replies

CODE - For Next Loop - Program To Display The Most Active Year For Storms Between The Years 1990-2008

Sep 23, 2010

The program I am working on uses arrays and a text file. In one section of the program it's suppose to display the most active year for storms between the years 1990-2008. The year that has the most active storms is 2005, but I don't know how to write it in the code so that it displays. Attached is the text file.

So far I have a For Next loop that counts the arrays.

Public Class frmHurricanes
' Class Level Variables
Public Shared _intSizeOfArray As Integer = 18

[CODE]...

View 6 Replies

Reference A Particular Code Routine In .net External To The Current Loop/routine?

Apr 17, 2011

is there any way to reference a particular code routine in VB.net external to the current loop/routine?Example:

If Var01 < 5
[Routine A]
Else
[Routine B]
End If

where Routine A and Routine B are code sequences at the end of the entire program -- such as outside of the current sub or class? The idea would be to reference an otherwise repetitive code.

View 4 Replies

Password Loop Textbox - Code Works To Read The Entry Data And To Recognise The Correct Data, And The Incorrect

Apr 16, 2012

CODE:

That code works to read the entry data and to recognise the correct data, and the incorrect. However, even if entry is correct, the error msgbox will appear (x times of how many records there are in file), despite being navigated to the menu. Anyway that the Else isn't triggered when data is correct. Also for it to appear just one instead of (x times of how many records there are in file.)

View 2 Replies







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