4 Replies - 1479 Views - Last Post: 19 May 2008 - 10:03 AM Rate Topic: -----

#1 BooBooJr  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 14
  • Joined: 15-May 08

Reading a file and its values using a combo box

Posted 17 May 2008 - 09:54 AM

Hi people!

need some more help on my project.
In my program i am able to save some values in a file on 1 form as shown below:

Private Sub cmdSave_Click()
	Dim Response As String
	Response = InputBox("Save data as...")
	Open Response For Output As #1
		Print #1, txtMedian.Text, txtLowerQuartile.Text, txtUpperQuartile.Text, _
			txtInterquartileRange.Text, txtMaxValue.Text, txtMinValue.Text
	Close #1
	
End Sub


But now, in a different form i want to use the values from this file. At the moment, i managed to get the combo box to recognise the files but what i want is as soon as 1 of these files is selected in the box, the values are straight away shown on some text boxes i have already set up. How do i go about doing so?

Private Sub Form_Activate()
	Dim temps As String
	temps = Dir("*.txt")
	cboDir1.AddItem (temps)
	cboDir2.AddItem (temps)
	Do Until temps = ""
		temps = Dir
		cboDir1.AddItem (temps)
		cboDir2.AddItem (temps)
	Loop

End Sub


Free bunny for anyone who helps me ^_^

(\ /)
( . .)
C('')('')

This post has been edited by BooBooJr: 17 May 2008 - 09:54 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Reading a file and its values using a combo box

#2 BooBooJr  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 14
  • Joined: 15-May 08

Re: Reading a file and its values using a combo box

Posted 18 May 2008 - 07:42 AM

im guessing the free bunny was a turn off then =S
Was This Post Helpful? 0
  • +
  • -

#3 sam_benne  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 16
  • View blog
  • Posts: 732
  • Joined: 16-January 08

Re: Reading a file and its values using a combo box

Posted 19 May 2008 - 02:04 AM

Are you sending the data from the text boxes from one form to a combo box in another form? Because if you are you would then need a module to declare the text boxes as string.
Global txtMedian.Text As String



Or you can make txtMedian.Text equal to StrMedian and make that the global variable.

Then in the second form for the combo box do something like:
cboDir1.AddItem StrMedian


Was This Post Helpful? 0
  • +
  • -

#4 BooBooJr  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 14
  • Joined: 15-May 08

Re: Reading a file and its values using a combo box

Posted 19 May 2008 - 09:30 AM

View Postsam_benne, on 19 May, 2008 - 02:04 AM, said:

Are you sending the data from the text boxes from one form to a combo box in another form? Because if you are you would then need a module to declare the text boxes as string.
Global txtMedian.Text As String



Or you can make txtMedian.Text equal to StrMedian and make that the global variable.

Then in the second form for the combo box do something like:
cboDir1.AddItem StrMedian




im actually using the values from a text file which i saved from the 1st code above and all i want is to use those values from the text file and put them into a text box in the form.
Was This Post Helpful? 0
  • +
  • -

#5 sam_benne  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 16
  • View blog
  • Posts: 732
  • Joined: 16-January 08

Re: Reading a file and its values using a combo box

Posted 19 May 2008 - 10:03 AM

Well when it open you make it equal a textbox.
Here is what I would do:
Dim text As String

Open "FilePath" For Input As #1
		Input #1, Combo
	Text1.Text = Combo
	Close #1


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1