473,396 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

get the time from inf file

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
7 1272
r035198x
13,262 8TB
Check the exception message again. Which line number of your code is it reporting?
Apr 8 '13 #2
its not showing any error in the line ... its showing some inner execption error
Apr 8 '13 #3
vijay6
158 100+
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
vijay6
158 100+
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
line 19 i mentioned no z = ....
Apr 9 '13 #6
vijay6
158 100+
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
thanx vijay.... u r rite ......... small thing ... i dint recognised ....well thanx again bro
Apr 9 '13 #8

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

Similar topics

7
by: Eric Belanger | last post by:
Hi, Before posting I made sure I upgraded from 2.3.3 to 2.3.4, but the problem is still here. Ive created a little script which, at the end of it, deals with copying two files. All the script...
2
by: Count Dracula | last post by:
Is there a way to write a c++ program that will print out the last few lines of a file without reading the whole file? The implementations of 'tail' I have seen all appear to be system dependent....
2
by: msnews.microsoft.com | last post by:
Does the framework support the changing of a files Date and Time and if so is there sample could for which I can be directed?
3
by: Les Desser | last post by:
In A97 I am trying to determine some attributes of files in a folder - Date, time, file size and file name. To this end I have managed to create a batch file to do a Dir to a work file (and then...
5
by: Saket | last post by:
Hello All, I am want to open a file in C language where in i know the location of the file, but do not know its name. For this what i have done is: - 1) Used system command like and listed...
3
by: Jingnan Si | last post by:
Hi, I am porting a old application from Asp, in the old code, I am using "Server.CreateObject("Scripting.FileSystemObject")" to get the file short name in 8.3 format, but I am wondering if there...
9
by: Bob Achgill | last post by:
I would like to use the timestamp on files to manage the currency of support files for my VB windows application. In this case I would only put the timestamp of the file in the management database...
1
by: Christopher Lusardi | last post by:
How do I determine the last time a file was changed? Thanks, Christopher Lusardi
3
by: Rosario Morgan | last post by:
Hello Help is great appreciated in advance. I need to loop through a file 6000 bytes at a time. I was going to use the following but do not know how to advance through the file 6000 bytes at...
6
by: mukeshrasm | last post by:
Hi I am making a content management system. so the page will be created dynamically. I want to create run time file. how can I do that? Thanks
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.