[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Writing a value to text file is being wrongly displayed

Posted on 2007-11-27
1
Medium Priority
?
149 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 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

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

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

With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
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…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

656 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