Solved

Writing a value to text file is being wrongly displayed

Posted on 2007-11-27
1
145 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 11

Accepted Solution

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

.CurrentRow.Index is never wrong...
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
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…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

691 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