Click here to Skip to main content
16,008,719 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: grid with multiheader? Pin
cstrader2329-Nov-07 4:27
cstrader2329-Nov-07 4:27 
QuestionReading a text file backwards Pin
iSeeGhosts8-Nov-07 15:58
iSeeGhosts8-Nov-07 15:58 
AnswerRe: Reading a text file backwards Pin
Luc Pattyn8-Nov-07 16:26
sitebuilderLuc Pattyn8-Nov-07 16:26 
AnswerRe: Reading a text file backwards [modified] Pin
The ANZAC8-Nov-07 17:53
The ANZAC8-Nov-07 17:53 
Generaltypo Pin
Luc Pattyn8-Nov-07 17:56
sitebuilderLuc Pattyn8-Nov-07 17:56 
GeneralRe: typo Pin
The ANZAC8-Nov-07 17:57
The ANZAC8-Nov-07 17:57 
GeneralRe: typo Pin
iSeeGhosts10-Nov-07 8:45
iSeeGhosts10-Nov-07 8:45 
GeneralRe: typo Pin
The ANZAC10-Nov-07 11:18
The ANZAC10-Nov-07 11:18 
ok so what i did was create the currentrecord variable to keep track of exactly that, the record that is currently open. But how does it find each record? Well...

Dim Records() as string = file.readalllines("c\example")

This line makes a new array of strings (without affecting the contents of the original file), if your not sure what that is, best to google it, but i will explain breify. An array creates an indexed list from a given source that can be quickly an easily accessed.

For Instance, when we did the above line, the array would be visually represented like this.

Records(0) = aaa 333<br />
Records(1) = bbb 444<br />
Records(2) = ccc 555<br />
Records(3) = ddd 888<br />
Records(4) = ggg 111


Notice how the indexing starts at zero. Therefore there is the last item in the list (the fifth) has an index of four.

The Records.length gives us the total amount of items in the list. So...because each item has an index of one less than the amount it is, the last item has the index (records.length - 1).

So. Say for instance our current record is 4 (ggg 111). When we use the line you asked about it will check if this is less than the final item, and will do the appropriate action. However because it is the final item it will do nothing, as trying to display one more than this would result in an IndexOutOfBoundsException meaning that there is no such item.

If you veiw the statement in full, you see that by the time we get to line 3, the current record integer is equal to 5, which won't work. If an item with the specified index does exist than this is what we call 'within bounds'.

1    if currentrecord < (records.length - 1) then<br />
2    currentrecord +=1<br />
3    me.displaytextbox.text = records(currentrecord)<br />
4    end if


The if statements are basically error prevention, they stop your program crashing when there is no data where you are asking for it.

Please check out my articles:
The ANZAC's articles

QuestionHelp on Report Viewer Pin
Abbhie8-Nov-07 15:08
Abbhie8-Nov-07 15:08 
AnswerRe: Help on Report Viewer Pin
pmarfleet9-Nov-07 3:09
pmarfleet9-Nov-07 3:09 
Questionhow to change the highlight color of a treeview? PinPopular
lee238-Nov-07 15:00
lee238-Nov-07 15:00 
QuestionVB Shell Folder error handler Pin
reegan418-Nov-07 10:39
reegan418-Nov-07 10:39 
AnswerRe: VB Shell Folder error handler Pin
Mycroft Holmes8-Nov-07 16:00
professionalMycroft Holmes8-Nov-07 16:00 
QuestionDelegate Question Pin
midnightshifting8-Nov-07 8:08
midnightshifting8-Nov-07 8:08 
AnswerRe: Delegate Question Pin
MidwestLimey8-Nov-07 8:52
professionalMidwestLimey8-Nov-07 8:52 
QuestionDeploying Com Wrapped DLL that has a webreference Pin
nlarson118-Nov-07 4:28
nlarson118-Nov-07 4:28 
Questionssh database connection in vb.net Pin
tj288-Nov-07 3:33
tj288-Nov-07 3:33 
QuestionNeed help to collect forest-wide group policy information. Pin
kingpin20058-Nov-07 3:16
kingpin20058-Nov-07 3:16 
QuestionA simpale Question Pin
half-life8-Nov-07 2:38
half-life8-Nov-07 2:38 
AnswerRe: A simpale Question Pin
AliAmjad8-Nov-07 2:43
AliAmjad8-Nov-07 2:43 
GeneralRe: A simpale Question Pin
half-life8-Nov-07 3:14
half-life8-Nov-07 3:14 
AnswerRe: A simpale Question Pin
Luc Pattyn8-Nov-07 3:00
sitebuilderLuc Pattyn8-Nov-07 3:00 
AnswerRe: A simpale Question Pin
MikeMarq8-Nov-07 4:37
MikeMarq8-Nov-07 4:37 
QuestionEPSON Printer Pin
briogene8-Nov-07 2:25
briogene8-Nov-07 2:25 
Questionquestion with chklistbox Pin
eyes20078-Nov-07 1:48
eyes20078-Nov-07 1:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.