Solved

Writing a value to text file is being wrongly displayed

Posted on 2007-11-27
1
141 Views
Last Modified: 2010-04-23
I have the following block of simple code which writes the row index of the current selected cell. The odd thing is, when I perform the code, sometimes it will set the correct index in the textfile e.g. row 1 is index 0 I believe, yet other times I will perform it on the same row 1 and the index will be set to 640 or another incorrect number.

Do you see anything wrong:
'This is the code which writes to the text file:

        If Main.TabControl1.SelectedIndex = "3" Then My.Computer.FileSystem.WriteAllText("C:\Old Time Radio\MyFavoriteOTR\Texts\CoupleNextDoor.txt", _

Main.CoupleNextDoorDataGridView.CurrentRow.Index, True)
 

'This is the code which reads from the file (this works fine but is added for clarity)
 

fileReader = My.Computer.FileSystem.ReadAllText("C:\Old Time Radio\MyFavoriteOTR\Texts\CoupleNextDoor.txt")

CoupleNextDoorDataGridView.FirstDisplayedScrollingRowIndex = fileReader

Open in new window

0
Comment
Question by:BIGZIPZ1
1 Comment
 
LVL 11

Accepted Solution

by:
AkisC earned 500 total points
Comment Utility
Try changing the
Main.CoupleNextDoorDataGridView.CurrentRow.Index
-to-
Me.CoupleNextDoorDataGridView.CurrentRow.Index

.CurrentRow.Index is never wrong...
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
SAPE.heur.AE935 Visual Studio 3 16
Query datatable in LINQ 6 39
Asp/Net Validation date Issue 9 37
Total in textboxes 9 35
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now