By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 1,619 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 IT Pros & Developers. It's quick & easy.

get the time from inf file

P: 56
here is my code
Expand|Select|Wrap|Line Numbers
  1.  
  2.  Dim objReader As String = "c:\New Text Document.inf"
  3.     Dim sLine As String = ""
  4.     Dim Lines() As String
  5.     Dim TextFromTheFile As String
  6.     Dim LineSeparator() As String = {Environment.NewLine}
  7.     Dim arrText As ArrayList
  8.     Dim i As Integer
  9.     Dim z As String
  10.  
  11.     Dim dt As DateTime = DateTime.Parse(z)
  12.  
  13.  
  14.  If My.Computer.FileSystem.FileExists(objReader) Then
  15.             TextFromTheFile = My.Computer.FileSystem.ReadAllText(objReader)
  16.             Lines = TextFromTheFile.Split(LineSeparator, System.StringSplitOptions.RemoveEmptyEntries)
  17.  
  18.             Button1.Text = Lines(2).Substring(Lines(2).IndexOf("=") + 2)
  19.             z = Lines(4).Substring(Lines(4).IndexOf("=") + 2)
  20.             i = Lines(1).Substring(Lines(1).IndexOf("=") + 2)
  21.         End If
  22.  
  23. If DateTime.Now.TimeOfDay > dt.TimeOfDay Then
  24.         MessageBox.Show("The current time is " & DateTime.Now)
  25.  
  26.         End If
  27.  
  28.  
error msg is showing
An error occurred creating the form. See Exception.InnerException for details. The error is: String reference not set to an instance of a String.
Parameter name: s



i cant able to understand y this error is for
Apr 8 '13 #1
Share this Question
Share on Google+
7 Replies


10K+
P: 13,264
Check the exception message again. Which line number of your code is it reporting?
Apr 8 '13 #2

P: 56
its not showing any error in the line ... its showing some inner execption error
Apr 8 '13 #3

100+
P: 158
Hey Syed Hadi, Check line number 11 in your code, you're converting string(z) to DateTime(dt) format but string(z) wasn't initialized.

Expand|Select|Wrap|Line Numbers
  1. Dim dt As DateTime = DateTime.Parse(z)
Apr 8 '13 #4

100+
P: 158
Hey Syed Hadi, Check line number 11 in your code, you're converting string (z) to DateTime (dt) format but string (z) wasn't initialized.

Expand|Select|Wrap|Line Numbers
  1. Dim dt As DateTime = DateTime.Parse(z)
Apr 8 '13 #5

P: 56
line 19 i mentioned no z = ....
Apr 9 '13 #6

100+
P: 158
Hey Syed Hadi, you're initializing the value for 'z' in line number 19 but you're reading the value of 'z' in line number 11 (i.e., before initialization you're reading the value of 'z').
Apr 9 '13 #7

P: 56
thanx vijay.... u r rite ......... small thing ... i dint recognised ....well thanx again bro
Apr 9 '13 #8

Post your reply

Sign in to post your reply or Sign up for a free account.