[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Writing a value to text file is being wrongly displayed

Posted on 2007-11-27
1
Medium Priority
?
151 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 2000 total points
ID: 20360533
Try changing the
Main.CoupleNextDoorDataGridView.CurrentRow.Index
-to-
Me.CoupleNextDoorDataGridView.CurrentRow.Index

.CurrentRow.Index is never wrong...
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …

872 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