can i get some guidence

need a general direction

  • (2 Pages)
  • +
  • 1
  • 2

22 Replies - 3574 Views - Last Post: 05 August 2006 - 02:21 PM Rate Topic: -----

#1 Phear  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 213
  • Joined: 10-July 06

can i get some guidence

Posted 01 August 2006 - 11:10 AM

iv been messing with vb for a little while now starting to get the hang of it, now i want to try something....

ok i want to (using vb express) create a simple program for storing names and contact information.... i assume this would be best done using a database of sorts....
im not looking for someone to code this for me i just need a little directional help

What type of database should i use?

Best methods of connecting vb and said database?

Any resources to lead me in the right direction.

Is This A Good Question/Topic? 0
  • +

Replies To: can i get some guidence

#2 the_hangman  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 14
  • View blog
  • Posts: 602
  • Joined: 18-January 06

Re: can i get some guidence

Posted 01 August 2006 - 11:29 AM

Well it depends on what you want really. Are you going to distribute the program, or are you going to be the only one to use it?
If you are going to be the only one you VB Express 2005 comes with a MySql server with functions for it built into the program (somewhere).

If you are going to distribute it you would have figure out something that everyone who will obtain it has access to. Do they have Microsoft Access? That's halfway decent database in my opinion. I'm not sure how to connect to it or how hard the commands are, but the guy in the office next to me right now uses Express to connect to Access databases all day long, so I could find out.

And... that's about all I've got
Was This Post Helpful? 0
  • +
  • -

#3 Phear  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 213
  • Joined: 10-July 06

Re: can i get some guidence

Posted 01 August 2006 - 11:33 AM

well i am making the program as sort of a test for myself but if it comes out good i would distribute it (for free of course) access is good but like you said not everyone will have it.... i see the dilema... if only there were a way to have a stand alone database.......
Was This Post Helpful? 0
  • +
  • -

#4 the_hangman  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 14
  • View blog
  • Posts: 602
  • Joined: 18-January 06

Re: can i get some guidence

Posted 01 August 2006 - 11:37 AM

This is sort of a far fetched idea, being that you are new to Vb (i know this because I am already trying the same idea that I am about to tell you, and I am new to VB as well)...

But someone told me about using comma delimited text files as databases.. I guess each comma is a new column and each carriage return is a new entry.

Everyone's computer can translate a text file, and if you are only adding minimal amounts of information it could work?
Was This Post Helpful? 0
  • +
  • -

#5 Phear  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 213
  • Joined: 10-July 06

Re: can i get some guidence

Posted 01 August 2006 - 11:48 AM

yes CSD (comma seperated data) was a thought of mine... its the same thing as a spread sheet w/o all the fancy formatting... is suppose it could work...

but i see a very very sensitive process of getting everything in the richt place or else it will throw everything off.... each entry could be like:

Name,PhoneNumber,Address,Email,etc.

1 entry to a line....

heres what im thinking (in psudo code):

take one line of data as shown above
seperate each piece into seperate vairables
display each piece neatly in interface
save changes back to the same format as above


obviously there is inbetween steps such as declaring each variable and such but will it be possible to read and write in a format like that?

... im going to take a nap(i only slept for 2 hours last night) maybe ill have a dream in code and figure out the answers to my problems....

This post has been edited by Phear: 01 August 2006 - 12:15 PM

Was This Post Helpful? 0
  • +
  • -

#6 born2c0de  Icon User is offline

  • printf("I'm a %XR",195936478);
  • member icon

Reputation: 180
  • View blog
  • Posts: 4,667
  • Joined: 26-November 04

Re: can i get some guidence

Posted 02 August 2006 - 08:29 AM

You can choose either Microsoft Access or an Oracle Database.
Both are simple to access using VB.
Was This Post Helpful? 0
  • +
  • -

#7 the_hangman  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 14
  • View blog
  • Posts: 602
  • Joined: 18-January 06

Re: can i get some guidence

Posted 03 August 2006 - 07:38 AM

Do we have any good link or tutorials on using the delimited files for data?
Was This Post Helpful? 0
  • +
  • -

#8 Xenon  Icon User is offline

  • Connection failed
  • member icon

Reputation: 8
  • View blog
  • Posts: 1,595
  • Joined: 12-September 05

Re: can i get some guidence

Posted 03 August 2006 - 10:35 AM

i think i have a tutorial on connectin with databases. in vb6 i think
Was This Post Helpful? 0
  • +
  • -

#9 the_hangman  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 14
  • View blog
  • Posts: 602
  • Joined: 18-January 06

Re: can i get some guidence

Posted 03 August 2006 - 11:25 AM

Well I got it to read the delimited file, and I can even populate the fields. But how do I get it to just read to the first delimiter and then go to the next line. Basically just returning the first field on each line?
Was This Post Helpful? 0
  • +
  • -

#10 Phear  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 213
  • Joined: 10-July 06

Re: can i get some guidence

Posted 03 August 2006 - 01:19 PM

how, id you dont mind me asking, did you get it to populate the fields?
... i can read the data, but not write it...

not that i like changing direction... but would an xml file also work to store this data? (i dont really kno much about xml only used it once to make a media player in flash for song list)

Update: after researching quite a bit i got a few things useful...

streamreader to read data line by line and .split [at] ,

This post has been edited by Phear: 03 August 2006 - 01:38 PM

Was This Post Helpful? 0
  • +
  • -

#11 the_hangman  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 14
  • View blog
  • Posts: 602
  • Joined: 18-January 06

Re: can i get some guidence

Posted 03 August 2006 - 01:54 PM

		Dim filename As String = "filenamehere.txt"
		Dim fields As String()
		Dim delimiter As String = ","
		Using parser As New TextFieldParser(filename)
			parser.SetDelimiters(delimiter)
			While Not parser.EndOfData
				' Read in the fields for the current line
				fields = parser.ReadFields()
				ListBox1.Items.AddRange(fields)
			End While
		End Using
	End Sub


I never thought about XML.. that might work!
Was This Post Helpful? 0
  • +
  • -

#12 Phear  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 213
  • Joined: 10-July 06

Re: can i get some guidence

Posted 03 August 2006 - 04:43 PM

ahhh i c.... i will play with this maybe i can think of somehting.... also still researching stream reading
Was This Post Helpful? 0
  • +
  • -

#13 Jayman  Icon User is offline

  • Student of Life
  • member icon

Reputation: 418
  • View blog
  • Posts: 9,532
  • Joined: 26-December 05

Re: can i get some guidence

Posted 03 August 2006 - 07:00 PM

Easiest way is to use StreamReader and StreamWriter objects. You are correct in that StreamReader will read an entire line at a time until it hits a EOL character. With the returned line from the StreamReader object you can use IndexOf() and Substring() to split the line apart.
Here is the MSDN on StreamReader.
http://msdn.microsof...rclasstopic.asp

Quote

Well I got it to read the delimited file, and I can even populate the fields. But how do I get it to just read to the first delimiter and then go to the next line. Basically just returning the first field on each line?


Create a Structure to hold each bit of information stored on one line inside your file. A Structure is just a user defined variable that holds many different data types.

Here is the link to Structures.
http://msdn.microsof...wndatatypes.asp

As you are looping throught the records reading them, just output the Structrure.variablename that you defined. This way you can read an entire line at a time and only output the first field from each line item.

You could also do it without creating a Structure. You just read each line in, split the line at the commas and output the first item.

This post has been edited by jayman9: 03 August 2006 - 07:08 PM

Was This Post Helpful? 0
  • +
  • -

#14 Phear  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 213
  • Joined: 10-July 06

Re: can i get some guidence

Posted 04 August 2006 - 06:13 AM

Quote

Easiest way is to use StreamReader and StreamWriter objects...
....and output the first item.


now we are getting somewhere thanks much very helpful post

Imports System
Imports System.IO
Class Test
	Public Shared Sub Main()
		Try
			' Create an instance of StreamReader to read from a file.
			Dim sr As StreamReader = New StreamReader("TestFile.txt")
			Dim line As String
			' Read and display the lines from the file until the end 
			' of the file is reached.
			Do
				line = sr.ReadLine()
				Console.WriteLine(Line)
			Loop Until line Is Nothing
			sr.Close()
		Catch E As Exception
			' Let the user know what went wrong.
			Console.WriteLine("The file could not be read:")
			Console.WriteLine(E.Message)
		End Try
	End Sub
End Class

This post has been edited by Phear: 04 August 2006 - 06:23 AM

Was This Post Helpful? 0
  • +
  • -

#15 the_hangman  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 14
  • View blog
  • Posts: 602
  • Joined: 18-January 06

Re: can i get some guidence

Posted 04 August 2006 - 10:15 AM

Quote

You could also do it without creating a Structure. You just read each line in, split the line at the commas and output the first item.


I know nothing of structures and the MSDN isn't making much sense to me right now (remember: me="novice"), so how do you split the line at the commas?
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2