473,378 Members | 1,518 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,378 software developers and data experts.

VB6 Checkbox read

104 100+
Good day all, newbie here.

I have written the code to output the checkbox to a txt file for record purposes. The "Tick".......... so that at run time it reads the "setting" of this box.

Expand|Select|Wrap|Line Numbers
  1. Dim set1 As String
  2.      fileName = App.Path & "\" & "\data\set1.txt"
  3.      set1 = FreeFile
  4.     Open fileName For Output As #set1
  5.     Print #set1, Check1
  6.     Close #set1
Firstly in my text file the result is listed as " 1" - Is that correct?
Secondly on reading the data back I am not sure what the parameter should be in the code below marked with "?" error = Method or datamember not found

Expand|Select|Wrap|Line Numbers
  1. Dim set1 As Integer
  2.    fileName = App.Path & "\" & "\data\set1.txt"
  3.    set1 = FreeFile
  4.    Open fileName For Input As #set1
  5.    While Not EOF(set1)
  6.         Line Input #set1, tempStr
  7.         Check1.Text ??????? = Check1.Text ???????? & tempStr
  8.            Wend
  9.    Close #set1
If anyone could shed light it would be appreciated

Thanks
Aug 10 '07 #1
4 1909
Killer42
8,435 Expert 8TB
I think you're missing a couple of fundamental points here.
  1. When you simply refer to a control, as in Print #set1, Check1 without specifying what property you mean, VB will select the default property. In the case of a checkbox control, that's the Value property. Which mean that you will be writing a 0 or a 1 to the file. (Or possibly a 2, but probably not.)
  2. Checkboxes do not have a Text property. They have a Caption property (the label, displaying such things as "Check1" or "Click here"). In this case though, you are more likely trying to read back the Value property.
Aug 10 '07 #2
Wernerh
104 100+
I think you're missing a couple of fundamental points here.
  1. When you simply refer to a control, as in Print #set1, Check1 without specifying what property you mean, VB will select the default property. In the case of a checkbox control, that's the Value property. Which mean that you will be writing a 0 or a 1 to the file. (Or possibly a 2, but probably not.)
  2. Checkboxes do not have a Text property. They have a Caption property (the label, displaying such things as "Check1" or "Click here"). In this case though, you are more likely trying to read back the Value property.
He he he. I am obviously missing a couple of points, but am trying to understand the logic VB. I am self taught for about a month now, so am trying to get to grips with the lingo. I am still in the dark, are you saying that what i have done is write the value to the text. Ok get that, but then how do i save the "tick" for the checkbox in the application?

Thanks
Aug 10 '07 #3
Killer42
8,435 Expert 8TB
He he he. I am obviously missing a couple of points, but am trying to understand the logic VB. I am self taught for about a month now, so am trying to get to grips with the lingo. I am still in the dark, are you saying that what i have done is write the value to the text. Ok get that, but then how do i save the "tick" for the checkbox in the application?
The "tick" of a checkbox is found in its Value property.

Your code was (more or less by accident) writing this out correctly to the file. But you were trying to read it back into the Text property - which doesn't exist. You need to read it back into the Value property, where it came from.

For a "one-monther" I'd say you're doing very well. The real secret is learning to think like a computer. That is, dumb and extremely literal. People always try to work out what a program does as though the computer is sensible, rather than following through precisely what the code says. Just remember computers are stupid, and you'll be fine. :)
Aug 11 '07 #4
Wernerh
104 100+
The "tick" of a checkbox is found in its Value property.

Your code was (more or less by accident) writing this out correctly to the file. But you were trying to read it back into the Text property - which doesn't exist. You need to read it back into the Value property, where it came from.

For a "one-monther" I'd say you're doing very well. The real secret is learning to think like a computer. That is, dumb and extremely literal. People always try to work out what a program does as though the computer is sensible, rather than following through precisely what the code says. Just remember computers are stupid, and you'll be fine. :)
Thanks Killer42, I am starting t get the hang of it, but like anything it takes time, practise and a bucket load of patience to get things working. Thanks for the input and thank you for the support.
Aug 13 '07 #5

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

Similar topics

4
by: Bill | last post by:
I have a catalog of books which need to be categorized into different groups. Some of the books can be listed under more than one category. I'm creating a page where I can assign a group of books...
2
by: Robin | last post by:
I need to add a checkbox to the common dialog control for opening files. I know it is possible to customize the common dialog thru API. But the sample codes I have seen were too long and...
2
by: /.. | last post by:
Hi all, I'm working on a report display page that currently uses 5 checkboxlists with a total of 86 items to display values from 5 different tables in an Access database. The page works fine...
0
by: mike | last post by:
Hi there: I've read an excellent "how to"-article by Microsoft (no. 306227) - partly cited cited at the end of this email). I have implemented the code related to the part "How to Add a...
0
by: simon | last post by:
I have datarepeater with checkBox: <ItemTemplate> <tr> <td><%# DataBinder.Eval(Container.DataItem,"adv_name") %></td> <td><%# DataBinder.Eval(Container.DataItem,"adv_start") %></td> <td><%#...
34
by: clinttoris | last post by:
Hello Experts, I have been told to post this in the Javascript forum as I want to do this client side just before my form gets submitted. Once the user clicks the submit button a javascript...
4
by: Hexman | last post by:
Hello All, I'd like to find out the best way to add a cb column to a dgv and process efficiently. I see at least two ways of doing it. ------------------------------- 1) Add a cb to the dgv,...
0
by: cyberdawg999 | last post by:
Greetings all in ASP land I have overcome one obstacle that took me 2 weeks to overcome and I did it!!!!! I am so elated!! thank you to all who invested their time and energy towards helping me...
11
by: =?Utf-8?B?UGFyYWcgR2Fpa3dhZA==?= | last post by:
Hi All, I have a large recordset to be displayed on a ASP 3.0 page. I am using recordset paging for this. For the next and previous link i am passing href as <a href=<Page URl>?page=<%=...
2
by: runway27 | last post by:
i am using a self submitting form <form action="<?php echo $_SERVER; ?>" method="POST" id="test2" name="test1"> i need to do a validation of textfields, checkboxes, radio buttons i am able...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.