﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>A1VBCode Forums / Visual Basic (VB 4/5/6) / General Visual Basic  / Help with homework / Latest Posts</title><generator>InstantForum.NET v4.1.1</generator><description>A1VBCode Forums</description><link>http://www.a1vbcode.com/vbforums/</link><webMaster>forums@a1vbcode.com</webMaster><lastBuildDate>Thu, 20 Nov 2008 11:49:06 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Help with homework</title><link>http://www.a1vbcode.com/vbforums/Topic24855-3-1.aspx</link><description>Mike, you may want to add this as the first command in the command1.Click event. It will eliminate odd looking MsgBox messages.&lt;DIV style="BORDER-RIGHT: #000000 3px solid; PADDING-RIGHT: 25px; BORDER-TOP: #000000 3px solid; PADDING-LEFT: 25px; BACKGROUND-IMAGE: none; PADDING-BOTTOM: 25px; BORDER-LEFT: #000000 3px solid; PADDING-TOP: 25px; BORDER-BOTTOM: #000000 3px solid; BACKGROUND-COLOR: #cccccc"&gt;&lt;FONT color=#0000cc&gt;If&lt;/FONT&gt; Text1.Text = "" &lt;FONT color=#0000cc&gt;Then&lt;/FONT&gt;&lt;BR&gt;      MsgBox "You did &lt;FONT color=#0000cc&gt;not&lt;/FONT&gt; enter anything!"&lt;BR&gt;      &lt;FONT color=#0000cc&gt;Exit&lt;/FONT&gt; &lt;FONT color=#0000cc&gt;Sub&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000cc&gt;End&lt;/FONT&gt; &lt;FONT color=#0000cc&gt;If&lt;/FONT&gt;&lt;BR&gt;&lt;/DIV&gt;</description><pubDate>Mon, 12 May 2008 11:37:29 GMT</pubDate><dc:creator>CDRIVE</dc:creator></item><item><title>RE: Help with homework</title><link>http://www.a1vbcode.com/vbforums/Topic24855-3-1.aspx</link><description>&lt;div class="Quote"&gt;&lt;b&gt;Mark (5/11/2008)&lt;/b&gt;&lt;hr noshade size="1" class="hr"&gt;This is pretty close to what Keith had suggested.&lt;/div&gt;&lt;P&gt;Mark, I'm glad you posted this. In my code (using a ListBox) I didn't include a MsgBox in the event of a match not found. After I posted that code I added it to my project using a Bln flag, much the same way that Keith did in his code. Eliminating the flag is a plus though. &lt;img align="absmiddle" src="http://www.a1vbcode.com/vbforums/Skins/Classic/Images/EmotIcons/Smile.gif" border="0" title="Smile"&gt; </description><pubDate>Sun, 11 May 2008 10:27:21 GMT</pubDate><dc:creator>CDRIVE</dc:creator></item><item><title>RE: Help with homework</title><link>http://www.a1vbcode.com/vbforums/Topic24855-3-1.aspx</link><description>This is pretty close to what Keith had suggested.&lt;/P&gt;&lt;DIV style="BORDER-RIGHT: #000000 3px solid; PADDING-RIGHT: 25px; BORDER-TOP: #000000 3px solid; PADDING-LEFT: 25px; BACKGROUND-IMAGE: none; PADDING-BOTTOM: 25px; BORDER-LEFT: #000000 3px solid; PADDING-TOP: 25px; BORDER-BOTTOM: #000000 3px solid; BACKGROUND-COLOR: #cccccc"&gt;&lt;FONT color=#0000cc&gt;Private&lt;/FONT&gt; &lt;FONT color=#0000cc&gt;Sub&lt;/FONT&gt; Command1_Click()&lt;BR&gt;&lt;FONT color=#0000cc&gt;Dim&lt;/FONT&gt; UB &lt;FONT color=#0000cc&gt;As&lt;/FONT&gt; &lt;FONT color=#0000cc&gt;Integer&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000cc&gt;Dim&lt;/FONT&gt; N &lt;FONT color=#0000cc&gt;As&lt;/FONT&gt; &lt;FONT color=#0000cc&gt;Integer&lt;/FONT&gt;&lt;BR&gt;&lt;BR&gt;    &lt;FONT color=#009900&gt;'UBound finds the upper value of an array&lt;/FONT&gt;&lt;BR&gt;    UB = &lt;FONT color=#0000cc&gt;UBound&lt;/FONT&gt;(lngAccounts)&lt;BR&gt;    &lt;BR&gt;    &lt;FONT color=#009900&gt;'Loop through the array and see if there is a match.&lt;/FONT&gt;&lt;BR&gt;    &lt;FONT color=#0000cc&gt;For&lt;/FONT&gt; N = 0 To UB&lt;BR&gt;        &lt;FONT color=#0000cc&gt;If&lt;/FONT&gt; lngAccounts(N) = &lt;FONT color=#0000cc&gt;Val&lt;/FONT&gt;(&lt;FONT color=#0000cc&gt;Trim&lt;/FONT&gt;(Text1.Text)) &lt;FONT color=#0000cc&gt;Then&lt;/FONT&gt;&lt;BR&gt;            &lt;FONT color=#009900&gt;'exit the loop if the item was found&lt;/FONT&gt;&lt;BR&gt;            &lt;FONT color=#0000cc&gt;Exit&lt;/FONT&gt; &lt;FONT color=#0000cc&gt;For&lt;/FONT&gt;&lt;BR&gt;        &lt;FONT color=#0000cc&gt;End&lt;/FONT&gt; &lt;FONT color=#0000cc&gt;If&lt;/FONT&gt;&lt;BR&gt;    &lt;FONT color=#0000cc&gt;Next&lt;/FONT&gt;&lt;BR&gt;    &lt;BR&gt;    &lt;FONT color=#009900&gt;'If the loop counter is greater than the UBound of the array the&lt;/FONT&gt;&lt;BR&gt;    &lt;FONT color=#009900&gt;'item was not found in the array.&lt;/FONT&gt;&lt;BR&gt;    &lt;FONT color=#0000cc&gt;If&lt;/FONT&gt; N &amp;gt; UB &lt;FONT color=#0000cc&gt;Then&lt;/FONT&gt;&lt;BR&gt;        MsgBox Text1.Text &amp;amp; " was &lt;FONT color=#0000cc&gt;not&lt;/FONT&gt; been found!"&lt;BR&gt;    &lt;FONT color=#0000cc&gt;Else&lt;/FONT&gt;&lt;BR&gt;        MsgBox Text1.Text &amp;amp; " was found at index position " &amp;amp; N&lt;BR&gt;    &lt;FONT color=#0000cc&gt;End&lt;/FONT&gt; &lt;FONT color=#0000cc&gt;If&lt;/FONT&gt;&lt;BR&gt;    &lt;BR&gt;&lt;FONT color=#0000cc&gt;End&lt;/FONT&gt; &lt;FONT color=#0000cc&gt;Sub&lt;/FONT&gt;&lt;BR&gt;&lt;/DIV&gt;</description><pubDate>Sun, 11 May 2008 09:42:00 GMT</pubDate><dc:creator>Mark</dc:creator></item><item><title>RE: Help with homework</title><link>http://www.a1vbcode.com/vbforums/Topic24855-3-1.aspx</link><description>Nicely put Chris. &lt;img align="absmiddle" src="http://www.a1vbcode.com/vbforums/Skins/Classic/Images/EmotIcons/Wink.gif" border="0" title="Wink"&gt;&lt;/P&gt;&lt;DIV style="BORDER-RIGHT: #000000 3px solid; PADDING-RIGHT: 25px; BORDER-TOP: #000000 3px solid; PADDING-LEFT: 25px; BACKGROUND-IMAGE: none; PADDING-BOTTOM: 25px; BORDER-LEFT: #000000 3px solid; PADDING-TOP: 25px; BORDER-BOTTOM: #000000 3px solid; BACKGROUND-COLOR: #cccccc"&gt;&lt;FONT color=#0000cc&gt;Option&lt;/FONT&gt; &lt;FONT color=#0000cc&gt;Explicit&lt;/FONT&gt;&lt;BR&gt;&lt;BR&gt;&lt;FONT color=#0000cc&gt;Dim&lt;/FONT&gt; lngAccounts(17) &lt;FONT color=#0000cc&gt;As&lt;/FONT&gt; &lt;FONT color=#0000cc&gt;Long&lt;/FONT&gt;&lt;BR&gt;&lt;BR&gt;&lt;FONT color=#0000cc&gt;Private&lt;/FONT&gt; &lt;FONT color=#0000cc&gt;Sub&lt;/FONT&gt; Command1_Click()&lt;BR&gt;&lt;BR&gt;&lt;FONT color=#0000cc&gt;Dim&lt;/FONT&gt; N &lt;FONT color=#0000cc&gt;As&lt;/FONT&gt; &lt;FONT color=#0000cc&gt;Integer&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000cc&gt;Dim&lt;/FONT&gt; Found &lt;FONT color=#0000cc&gt;As&lt;/FONT&gt; &lt;FONT color=#0000cc&gt;Boolean&lt;/FONT&gt;&lt;BR&gt;&lt;BR&gt;&lt;FONT color=#009900&gt;'UBound finds the upper value of an array&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000cc&gt;For&lt;/FONT&gt; N = 0 &lt;FONT color=#0000cc&gt;To&lt;/FONT&gt; &lt;FONT color=#0000cc&gt;UBound&lt;/FONT&gt;(lngAccounts)&lt;BR&gt;    &lt;FONT color=#0000cc&gt;If&lt;/FONT&gt; lngAccounts(N) = &lt;FONT color=#0000cc&gt;Val&lt;/FONT&gt;(&lt;FONT color=#0000cc&gt;Trim&lt;/FONT&gt;(Text1.Text)) &lt;FONT color=#0000cc&gt;Then&lt;/FONT&gt;&lt;BR&gt;        MsgBox Text1.Text &amp;amp; " &lt;FONT color=#0000cc&gt;as&lt;/FONT&gt; been found!"&lt;BR&gt;        Found = &lt;FONT color=#0000cc&gt;True&lt;/FONT&gt;&lt;BR&gt;    &lt;FONT color=#0000cc&gt;End&lt;/FONT&gt; &lt;FONT color=#0000cc&gt;If&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000cc&gt;Next&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000cc&gt;If&lt;/FONT&gt; Found = &lt;FONT color=#0000cc&gt;False&lt;/FONT&gt; &lt;FONT color=#0000cc&gt;Then&lt;/FONT&gt;&lt;BR&gt;    MsgBox Text1.Text &amp;amp; " &lt;FONT color=#0000cc&gt;as&lt;/FONT&gt; &lt;FONT color=#0000cc&gt;not&lt;/FONT&gt; been found!"&lt;BR&gt;&lt;FONT color=#0000cc&gt;End&lt;/FONT&gt; &lt;FONT color=#0000cc&gt;If&lt;/FONT&gt;&lt;BR&gt;&lt;BR&gt;&lt;FONT color=#0000cc&gt;End&lt;/FONT&gt; &lt;FONT color=#0000cc&gt;Sub&lt;/FONT&gt;&lt;BR&gt;&lt;BR&gt;&lt;FONT color=#0000cc&gt;Private&lt;/FONT&gt; &lt;FONT color=#0000cc&gt;Sub&lt;/FONT&gt; Form_Load()&lt;BR&gt;&lt;BR&gt;lngAccounts(0) = 5658845&lt;BR&gt;lngAccounts(1) = 4520125&lt;BR&gt;lngAccounts(2) = 7895122&lt;BR&gt;lngAccounts(3) = 8777541&lt;BR&gt;lngAccounts(4) = 8451277&lt;BR&gt;lngAccounts(5) = 1302850&lt;BR&gt;lngAccounts(6) = 8080152&lt;BR&gt;lngAccounts(7) = 4562555&lt;BR&gt;lngAccounts(8) = 5552012&lt;BR&gt;lngAccounts(9) = 5050552&lt;BR&gt;lngAccounts(10) = 7825877&lt;BR&gt;lngAccounts(11) = 1250255&lt;BR&gt;lngAccounts(12) = 1005231&lt;BR&gt;lngAccounts(13) = 6545231&lt;BR&gt;lngAccounts(14) = 3852085&lt;BR&gt;lngAccounts(15) = 7576651&lt;BR&gt;lngAccounts(16) = 7881200&lt;BR&gt;lngAccounts(17) = 4581002&lt;BR&gt;&lt;BR&gt;&lt;FONT color=#0000cc&gt;End&lt;/FONT&gt; &lt;FONT color=#0000cc&gt;Sub&lt;/FONT&gt;&lt;BR&gt;&lt;BR&gt;&lt;/DIV&gt;</description><pubDate>Sun, 11 May 2008 07:25:34 GMT</pubDate><dc:creator>Keithuk</dc:creator></item><item><title>RE: Help with homework</title><link>http://www.a1vbcode.com/vbforums/Topic24855-3-1.aspx</link><description>&lt;div class="Quote"&gt;&lt;b&gt;mike123 (5/10/2008)&lt;/b&gt;&lt;hr noshade size="1" class="hr"&gt;&lt;BR&gt;I'm having trouble with checking the number from the textbox with the numbers in the arrays. I'm not really sure where to go from here.&lt;BR&gt;&lt;BR&gt;Here is what I have so far:&lt;BR&gt;&lt;BR&gt;Dim intAccounts(17) As Integer&lt;BR&gt;Dim intCount As Integer&lt;BR&gt;&lt;BR&gt;intAccounts(0) = 5658845&lt;BR&gt;intAccounts(1) = 4520125&lt;BR&gt;intAccounts(2) = 7895122&lt;BR&gt;&lt;/div&gt; &lt;P&gt;Mike, the first thing you need to do is change intAccounts(17) to a &lt;STRONG&gt;Long Integer, &lt;/STRONG&gt;or you will get an &lt;STRONG&gt;Overflow &lt;/STRONG&gt;error.&lt;/P&gt;&lt;DIV style="BORDER-RIGHT: #000000 3px solid; PADDING-RIGHT: 25px; BORDER-TOP: #000000 3px solid; PADDING-LEFT: 25px; BACKGROUND-IMAGE: none; PADDING-BOTTOM: 25px; BORDER-LEFT: #000000 3px solid; PADDING-TOP: 25px; BORDER-BOTTOM: #000000 3px solid; BACKGROUND-COLOR: #cccccc"&gt;&lt;FONT color=#0000cc&gt;Option&lt;/FONT&gt; &lt;FONT color=#0000cc&gt;Explicit&lt;/FONT&gt;&lt;BR&gt;&lt;FONT color=#0000cc&gt;Dim&lt;/FONT&gt; lngAccounts(17) &lt;FONT color=#0000cc&gt;As&lt;/FONT&gt; &lt;FONT color=#0000cc&gt;Long&lt;/FONT&gt;&lt;BR&gt;&lt;/DIV&gt;&lt;P&gt;Integers can only hold numerical values between &lt;STRONG&gt;-32,768 to 32,767. &lt;/STRONG&gt;Secondly, if your instructor will permit you to use a &lt;STRONG&gt;ListBox &lt;/STRONG&gt;along with your &lt;STRONG&gt;TextBox &lt;/STRONG&gt;it will make searching for a value match very convenient. Once you have the array values in a ListBox you can search for a match with something like this partial code that goes in a&lt;STRONG&gt; For - Next Loop&lt;/STRONG&gt;...&lt;/P&gt;&lt;DIV style="BORDER-RIGHT: #000000 3px solid; PADDING-RIGHT: 25px; BORDER-TOP: #000000 3px solid; PADDING-LEFT: 25px; BACKGROUND-IMAGE: none; PADDING-BOTTOM: 25px; BORDER-LEFT: #000000 3px solid; PADDING-TOP: 25px; BORDER-BOTTOM: #000000 3px solid; BACKGROUND-COLOR: #cccccc"&gt;&lt;FONT color=#0000cc&gt;If&lt;/FONT&gt; (lngAccounts(i)) = Text1.Text &lt;FONT color=#0000cc&gt;Then&lt;/FONT&gt;&lt;BR&gt;         List1.ListIndex = (i)&lt;BR&gt;         MsgBox "A Match Has Been Found!"&lt;BR&gt;&lt;FONT color=#0000cc&gt;End&lt;/FONT&gt; &lt;FONT color=#0000cc&gt;If&lt;/FONT&gt;&lt;BR&gt;&lt;/DIV&gt;&lt;P&gt;As Keith stated earlier, we will help with assignments but encourage the student to take the initiative to at least attempt to complete the code snippets themselves. &lt;/P&gt;&lt;P&gt;Good luck! &lt;img align="absmiddle" src="http://www.a1vbcode.com/vbforums/Skins/Classic/Images/EmotIcons/Smile.gif" border="0" title="Smile"&gt;</description><pubDate>Sun, 11 May 2008 00:23:18 GMT</pubDate><dc:creator>CDRIVE</dc:creator></item><item><title>RE: Help with homework</title><link>http://www.a1vbcode.com/vbforums/Topic24855-3-1.aspx</link><description>Hi Keithuk. I have seen helping a lot of people on this forum. First I want to thank you for your time.&lt;br&gt;&lt;br&gt;I'm having trouble with checking the number from the textbox with the numbers in the arrays. I'm not really sure where to go from here.&lt;br&gt;&lt;br&gt;Here is what I have so far:&lt;br&gt; &lt;br&gt;        Dim intAccounts(17) As Integer&lt;br&gt;        Dim intCount As Integer&lt;br&gt;&lt;br&gt;        intAccounts(0) = 5658845&lt;br&gt;        intAccounts(1) = 4520125&lt;br&gt;        intAccounts(2) = 7895122&lt;br&gt;        intAccounts(3) = 8777541&lt;br&gt;        intAccounts(4) = 8451277&lt;br&gt;        intAccounts(5) = 1302850&lt;br&gt;        intAccounts(6) = 8080152&lt;br&gt;        intAccounts(7) = 4562555&lt;br&gt;        intAccounts(8) = 5552012&lt;br&gt;        intAccounts(9) = 5050552&lt;br&gt;        intAccounts(10) = 7825877&lt;br&gt;        intAccounts(11) = 1250255&lt;br&gt;        intAccounts(12) = 1005231&lt;br&gt;        intAccounts(13) = 6545231&lt;br&gt;        intAccounts(14) = 3852085&lt;br&gt;        intAccounts(15) = 7576651&lt;br&gt;        intAccounts(16) = 7881200&lt;br&gt;        intAccounts(17) = 4581002&lt;br&gt;&lt;br&gt;</description><pubDate>Sat, 10 May 2008 19:12:50 GMT</pubDate><dc:creator>mike123</dc:creator></item><item><title>RE: Help with homework</title><link>http://www.a1vbcode.com/vbforums/Topic24855-3-1.aspx</link><description>Welcome to A1vbcode &lt;STRONG&gt;Mike&lt;/STRONG&gt;. &lt;IMG src="http://www.a1vbcode.com/vbforums/Uploads/Images/5feb4545-abe2-4c56-b275-a006.gif"&gt;&lt;/P&gt;&lt;P&gt;Well we won't do homework for you but we will help with any problems you have.&lt;/P&gt;&lt;P&gt;Which part are you having trouble with?&lt;/P&gt;&lt;P&gt;Putting the number into an array?&lt;/P&gt;&lt;P&gt;Checking the number entered in a TextBox with the numbers in the array? &lt;img align="absmiddle" src="http://www.a1vbcode.com/vbforums/Skins/Classic/Images/EmotIcons/Wink.gif" border="0" title="Wink"&gt;</description><pubDate>Fri, 09 May 2008 10:43:13 GMT</pubDate><dc:creator>Keithuk</dc:creator></item><item><title>Help with homework</title><link>http://www.a1vbcode.com/vbforums/Topic24855-3-1.aspx</link><description>Hi. I am stuck on this problem and I could not find an examples. Can someone help me with this? I really appreciate it. Thank you in advance.&lt;br&gt;&lt;br&gt;Charge Account Validation:&lt;br&gt;Create an application that allows the user to enter a charge account number. The application should be determine whether the number is valid by comparing it to the numbers in the following list(there are more numbers but I'll just add to the code):&lt;br&gt;5658845&lt;br&gt;8080152&lt;br&gt;1005231&lt;br&gt;The list of numbers should be stored in an array. A sequential search should be used to locate the number entered by the user. If the user enters a number that is in the array, the program should display a message indicating the number is valid. If the user enters a number that is not in the array, the program should display a message indicating the number is invalid.&lt;br&gt;&lt;br&gt;&lt;br&gt;dim Accounts() as integer= {5658845,8080152,1005231}&lt;br&gt;&lt;br&gt;</description><pubDate>Thu, 08 May 2008 23:43:18 GMT</pubDate><dc:creator>mike123</dc:creator></item></channel></rss>