Making A Next Statement Into A Loop Statement In Visual Basic?

Jun 8, 2009

y friend and I are re-learning Visual Basic, and we are stumped on this bit of code.

For intAsterisks As Integer = 0 To intLine - 1
lblAsterisks.Text = lblAsterisks.Text + "*"
Next

View 6 Replies


ADVERTISEMENT

Give A Good Example Of The GOTO Statement In Visual Basic 2008?

Jan 15, 2010

I wanted a good example of the GOTO statement, I really want to know how to imply the goto statement in my future projects.

View 7 Replies

Visual Basic If Statement That Makes The User Check At Least One Box And Radio Button Or They Cannot Continue

Oct 5, 2011

This is what I have so far for the following scenario: I want to have it so that if a users clicks submit without checking a check box from one section it throws up a dialog box that makes the process loop and give them a chance to check a box. The process wont continue until at least one check box is checked. The same thing above goes for my radio buttons as well. Here's my code:

[Code]...

View 2 Replies

How For Each Loop Statement Actually Works

Dec 8, 2011

I am trying to understand how a for each loop works and am having some trouble. I am trying to create a program that will query a sql database, pull back the information and store it. I currently having it writing to a text file, and would like to take the information (such as name) and compare it to another list where the name is equal. However I am not exactly sure how the for each statement really works. I have looked at numerous sources and it doesn't make since to me as you can probably see from what I have put in here.

HTML
Public Class Form1
Public Sub newarrest()
Dim strsports As New System.Collections.Generic.List(Of String)
Dim employeelastname As New System.Collections.Generic.List(Of String)
Dim cnPodaci1 As New SqlConnection
[Code] .....

View 2 Replies

If Statement Or Where Extension With A For Each Loop?

Nov 18, 2009

I was wondering which of the two code samples would be more efficient (or is the difference between the two negligible)?[code]

View 4 Replies

Loop In DataRowview Using For Statement?

May 26, 2009

I am a new with using datarowview

The problem here is how to loop in dataRowview using for statement

View 5 Replies

While Loop Vs If Statement When Printing?

Jul 28, 2010

I'm practising printing, and doing fairly well - not as hard as I was thinking.

My question is: is it better/preferable to use a "while..." loop instead of an "If..then" statement when printing.

All my printing code is in various If statements (if PgNbr = 2, If PgNbr = 3 etc) but I notice in most of the examples and webpages I read that a lot of printing is done in a "while..." loop

View 4 Replies

SQL Statement Doesn't Work - INSERT Statement Works Fine In The Form Load But Not In The Button Click Event?

Oct 14, 2009

See

Public Class Form1
Dim sql As String
Dim conn As New OleDb.OleDbConnection
Dim da As New OleDb.OleDbDataAdapter

[CODE]...

The problem, The INSERT statement works fine in the form load but not in the button click event?

View 29 Replies

If <expression> Then <statement [:statement]> Else [statements] In Concrete Form?

Jan 1, 2010

I was convinced that If <expression> Then <statement [:statement]> Else [statements] in concrete form of If a = b Then SayHello() Else SayBye() End has sense. I read article on msdn on If-then-else, but I forgot why I was reading, so I concluded, that snippet above means this

If a = b Then HelloIsSaid : IsNotEnded Else ByeIsSaid : IsEnded But I have tested it now, and I see, that Else without statement is nothing more than decoration. It would be pretty good if it had function I described. Do you think its good request? Or do you know any circumstance where this Else has some function?

View 13 Replies

Sql - Perform An Inline Select Statement In A LINQ Statement?

Jun 24, 2011

I have the following SQL:

[Code]...

I want to put it (the select count statement) in this LINQ statement so I can get the sales count in my linq statement: Dim TheLeads = (From L In DB.Leads Where L.IsDeleted = False Select L).ToList() Is this possible to do in LINQ?

View 1 Replies

For Loop Statement With .count Method

Dec 7, 2011

For loop statement with .count method

View 1 Replies

SyncLock Required Before If Statement Or For Loop?

Oct 2, 2009

If completedOrders.Count <> 0 Then
For i = 0 To completedOrders.Count - 1
SyncLock completedOrders
'Do some work, for example this:
Dim text As String = completedOrders(0).getCN & " " & completedOrders(0).getDeviceName & " "
End SyncLock
Next
End If
Is a synclock needed before the if statement or for loop? In other words. When you call methods like .length or .count is it necessary to synclock them or can another thread be writing to it at the same time. CompletedOrders is a generic list of a class.

View 7 Replies

VB Update SQL Statement Inside For Loop?

Jun 27, 2012

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim s As New Staff

[Code]....

Basically I am trying to update each record with 2 random numbers each time the button was clicked,my problem now is, the system will update the record but the data was wrong. Example, by right all data should be different (randomly string) but for some row it was updated with same data but in randomly, something row1 row2 row3 has exactly same data for column 1 and 2 then row 3 has distinct data, second time, row1 row2 same data row3 ro4 with different data. It is in random sequence. When I add a MsgBox to do testing in the For loop the data was updated correctly with all different data.

View 2 Replies

SQL Statement Error - Setup A Basic Login Screen

Mar 14, 2012

I'm trying to build my first program and I've run into a few problems with SQL. I have a database with customers and employees (among other things) and I'm trying to set up a basic login screen. Users log in with their EmployeeID (primary key) This part deals with logging in for the first time. It checks the database for a user with that ID and grabs the password. If the password is not empty / null, it shows a message box and stops there. If the password is empty/null it is meant to confirm and then update the new password. This is where my understanding ends. Debugging shows the error is definitely in the SQL update, but I can't see any errors...

[Code]....

View 2 Replies

Put 10 Radiobutton Values In Insert Statement With While Loop

Jan 29, 2010

i have 10 radio buttons that have yes/no values. These are options to one question, so need to in the database under 1 record. so - question1 yes, question 1 no, question1 yes and so on. i want to use a while loop or some other loop to take all these values and insert them or update them in the database for that particular question. i m new to programming. the db table is ID, question, Answer. so it will be 1 question1 yes, 2 question1 yes, 3 question1 no.

View 2 Replies

Terminate A Do Loop Without Using An Exit Or Continue Statement?

Mar 11, 2010

I would like to terminate a do until ....loop when future value is greater than 1000 without using a Exit or Continue statement.

Do Until inti > intMonths
decFutureValue = (decFutureValue + decMonthlyInvestment) * (1 + decMonthlyInterestRate)
If decFutureValue > 1000 Then

[code]....

View 4 Replies

VS 2008 Using Greater And Less Than Parameters In A For Loop Statement

Jun 21, 2010

I am having a few issues with a For loop statement, code below:

Dim y1 as integer = "12"
Dim y2 as integer = "24"
Dim y2a as integer

[Code]....

Problem i have is that it selects all records that have a value equal to or less than 24 rather than the records that have a value greater than 12 and equal or less than 24. This appears to be an error i am making in the use of greater and less than?

View 3 Replies

Change The Exit Statement To A Continue Statement?

Feb 23, 2009

add an if statement and an exit statement to my do loop that exits when my future value (FV) is greater than 1000, then to change the exit statement to a continue statement so my loop will continue even though my fv is greater then 1000, point is to get this to run even though my if statement doesnt do anything. problem something wrong in my code and an exception error (xception of type 'System.OverflowException' occurred in mscorlib.dll)

so can someone show me where or why I have an error is, what am I overthinking now! I could use a hint, OMG i could use a tutor for that matter

[Code]...

View 3 Replies

ElseIf Statement Into A Select Case Statement?

Jun 23, 2010

A co-worker wants to convert the following IfThenElseIf statement into a Select Case statement.
Explain why this is not possible.

If temperature = 100 Then
X = 0
ElseIf population > 1000 Then
X = 1
ElseIf rate < .1 Then
X = -1
End If

View 7 Replies

SQL Statement :: Nearly Working Just Cant Get Form Values In Statement?

Aug 4, 2010

I cant get this SQL statement to insert any of the values in the form to add to the database

sql
sql = "INSERT INTO prevresults (ExamDate, ExamTime, CorrectAnswers, PassPercentage) VALUES (date.now, time.now, rightanswers, percentage.text)"

[code]....

View 4 Replies

Loop Statement - IF Process Is NOT Running - Delete The Files

Aug 12, 2010

I am currently teaching myself the caveman code of Visual Basic (VB.net). Apparently I fail at If-statements or something, because I cannot get this to work...

[Code]...

View 9 Replies

Performing Like Statement In For Each Loop To Check For Specific Item

Jun 17, 2011

Is it possible to define my list of strings like in 'good old' VB60, to use only on ebyte of memory for each character? .NET always seems to store any string as unicode, which doubles the required memory. The case is that I have a huge list of strings, all of the same size. It is about 50.000.000 items, 12 characters each. You can imagine I am running out of memory in no time. I tried converting them to arrays-of-bytes but in that case I loose the possibility to perform a "LIKE" statement in a FOR-EACH loop to check for a specific item.

View 6 Replies

VS 2005 Adding INSERT INTO Statement Inside A Loop

Jun 1, 2011

if I have the following vb code,

for i = 0 to dTable.Rows(i).Count -1
Dim sql As String = ""
Dim strConn As String = ConnString

[Code]....

View 10 Replies

When Remove 'Not' In 'Loop While' Statement Program Runs Indefinitely

May 11, 2009

[code] The problem in my case, this is not working with this code. All I need are random numbers outside the above boundaries.Please note when I remove 'Not' in 'Loop While' statement, the programme runs indefinitely!!

View 11 Replies

Cant Find Any Documentation On Making An API For A Visual Basic Application?

Mar 19, 2012

I cant find any documentation on making an API for a visual basic application. Does anyone have any ideas where I could start?

View 12 Replies

Visual Basic: Making Multiple Forms For An Orde?

Mar 31, 2012

I've been working on this project for two weeks now and I'm drained from all the hiccups I've come across. Now I've hit a brick wall.I'm making a "simple" order form in Visual Basic 2010 that calculates the amount due for an order and then from the total determines what the shipping will be. I've been able to accomplish the following tasks:accept customer data (name, address, city, state abbreviation, zipcode)calculate total with shipping costs (accurately, for the most part)clear the order form and exitBut the way I have it right now, a customer can only put in 1 order form.

Problem: I have to figure out a way to allow a customer to place an order form for multiple items. (I'll assume that a customer will not place an order for more than 20 items). So what would be the best way to go about saving the information for multiple items then calculating the cost at the end?If it's multiple form creation, how is that done? Is the keyword "Container" the way to go, and how

Snippet Code:
Private Sub total_mouseleave(ByVal sender As Object, ByVal e As EventArgs) Handles total.MouseLeave

[code].....

View 2 Replies

SQL Statement Runs In SQL Server- Not In Visual Studio?

Nov 23, 2010

I'm running Visual Studio 2008 and have been told that I have all rights to create #temp tables. I have done this before, but for some reason my sql in the new application always returns 0 rows.I have the SQL connection string stored in my Application events asFriend sqlConnProducts as StringI create a sql string and pass it to the SQLExecute Function

Private Function SQLExecute(ByVal sSQL As String) As DataTable
Dim rtnTable As New DataTable()
Dim sConn As New SqlConnection(My.Application.sqlConRecvInsp)

[code].....

View 3 Replies

Statement Completion In Visual Studio 2008 SP1?

Jul 10, 2009

After installing SP1 of Visual Studio 2008, code completion shows all types when an object member shows the parameter list. Before SP1, parameter list would only show related types.Take a look at this image for an example: This happens on a Windows 7 and Windows XP machines I have, all services packs installed.

View 1 Replies

Loop Statement - Display A Table Giving The Balance On The Loan At The End Of Each Month

May 17, 2010

I am trying to create a program in vbfor this problem: "A TV set is purchased with a loan of $563 to be paid off with 5 monthly payments of $116. The interest rate is 1 percent month. Display a table giving the balance on the loan at the end of each month". It must have 1 button and a list box that displays successive balances, contains loops to balances, loop code includes output to the list box, List box displays 2 columns (one for month and one for amount owed) and 5 months are displayed and the amount owed for each. The Amount Owed should go down each month from month 1 to month 5 where month 5 will equal to $0.00

Here is my code so far but somehow the 1 percent interest i cannot get to add on each month so I am not getting the write answer.

Code:
Dim rate As Decimal
Dim loan As Double
Dim pay As Double

[CODE]...

I have attached a jpeg of what the end result should look like when code is being run.

View 3 Replies

VS 2010 Read Multiple Text Files In My Resources By Using A Loop Statement?

Sep 29, 2010

I'm trying to create a "quiz" program in VB. The questions to be asked are placed inside text files and have the following format:

[code]...

> VB thinks that im trying to open a file named, what im trying to do is open a txt file which have a file name similar to the value of integer.

labelQuestion.text = variable.Readline().

View 4 Replies







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