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

A Hand Would Be Nice

P: 3
Hello there all,

Firstly i want to start by saying this is NOT a school project, just something i am trying to create because i have a little bit of spare time in the holidays, and i am always eager to give something new a try.

I did do vB at school in 2006, but it wasn't until i join a forum, like this one, that i realized i was using and OLD and OUTDATED version, not 05 edition, and so i could not get any help anywhere, and decided to abandoned my personal project.

But lately i decided it is unlike me to give up on something i started and so i am here now asking for you help =D

What Will My Program Do

My program, depending on the checked boxes and other various inputs, will create a simple text file.

What Im Stuck With Right Now

Expand|Select|Wrap|Line Numbers
  1.         If CheckBox1.CheckState = CheckState.Checked Then
  2.             write "example_example 2" to "Textbox1.text"
  3.         Else
  4.             write "example_example 0" to "Textbox1.text"
  5.         End If
Obviously my code is not working at all, and i have spent some time searching on the net for my answer but to not much avail.

As you can tell i am wanting the box if checked to write one thing, and if not to write another.

Not doubt i will need a hand later on in my project again, but for the time being a hand here would be great

Thanks all

- caek
Apr 3 '07 #1
Share this Question
Share on Google+
6 Replies


Expert 5K+
P: 8,434
Is it the test of the checkbox that you're stuck on, or writing to the textbox or text file?

Also, I didn't catch which version you are using, just that it wasn't "05 version". Which is slightly ambiguous, given that a lot of us are using VB5 or VB6, while others use various versions of VB.Net including VB 2005.

Based on the checkstate business, I'd guess it's VB 2005?
Apr 3 '07 #2

P: 3
Visual Basic 05 Express Edition?

http://msdn.microsoft.com/vstudio/express/downloads/

its a freebie

thanks for reply!

and im having trouble making the checkboxes place text into the textbox
Apr 3 '07 #3

Dököll
Expert 100+
P: 2,364
Hello there all,

Firstly i want to start by saying this is NOT a school project, just something i am trying to create because i have a little bit of spare time in the holidays, and i am always eager to give something new a try.

I did do vB at school in 2006, but it wasn't until i join a forum, like this one, that i realized i was using and OLD and OUTDATED version, not 05 edition, and so i could not get any help anywhere, and decided to abandoned my personal project.

But lately i decided it is unlike me to give up on something i started and so i am here now asking for you help =D

What Will My Program Do

My program, depending on the checked boxes and other various inputs, will create a simple text file.

What Im Stuck With Right Now

Expand|Select|Wrap|Line Numbers
  1.         If CheckBox1.CheckState = CheckState.Checked Then
  2.             write "example_example 2" to "Textbox1.text"
  3.         Else
  4.             write "example_example 0" to "Textbox1.text"
  5.         End If
Obviously my code is not working at all, and i have spent some time searching on the net for my answer but to not much avail.

As you can tell i am wanting the box if checked to write one thing, and if not to write another.

Not doubt i will need a hand later on in my project again, but for the time being a hand here would be great

Thanks all

- caek
I gave you a hand, but I do not think you heard me, get it:-)

I have been hinting trying out this download. How's VB 2005 workin'. Did you upgrade form VB 6? Looks like I'll need to wipe out my version of 6.0 if I download. You're in great hands, I'll stay quiet as I do not know too much in this arena. Good luck and have fun!
Apr 3 '07 #4

P: 3
I gave you a hand, but I do not think you heard me, get it:-)

I have been hinting trying out this download. How's VB 2005 workin'. Did you upgrade form VB 6? Looks like I'll need to wipe out my version of 6.0 if I download. You're in great hands, I'll stay quiet as I do not know too much in this arena. Good luck and have fun!
i dont follow your sorry, are u mistaking me for someone else?

So now i am having the problem that if i have more then one command being written to the textbox it erases the first command and the 2nd takes it place, is there and easy way to mend this?
Expand|Select|Wrap|Line Numbers
  1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  2.         'checkbox1
  3.         If CheckBox1.Checked Then
  4.             TextBox1.Text = "command_width 2"
  5.         Else
  6.             TextBox1.Text = "command_width 0"
  7.         End If
  8.         'checkbox2
  9.         If CheckBox1.Checked Then
  10.             TextBox1.Text = "command_length 2"
  11.         Else
  12.             TextBox1.Text = "command_length 0"
  13.         End If
  14.     End Sub
only writes either

command_length 2 or
command_length 0

thanks guys!
Apr 3 '07 #5

Dököll
Expert 100+
P: 2,364
i dont follow your sorry, are u mistaking me for someone else?

So now i am having the problem that if i have more then one command being written to the textbox it erases the first command and the 2nd takes it place, is there and easy way to mend this?

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'checkbox1
If CheckBox1.Checked Then
TextBox1.Text = "command_width 2"
Else
TextBox1.Text = "command_width 0"
End If
'checkbox2
If CheckBox1.Checked Then
TextBox1.Text = "command_length 2"
Else
TextBox1.Text = "command_length 0"
End If
End Sub

only writes either

command_length 2 or
command_length 0

thanks guys!
What I meant was, I applauded (gave you a hand) and you did not hear me. And you could not because we're communicating through a wire...Just being silly:-)

I am not sure what is happening to your code. I do have a question though. What is command_width...doing?

Are you just hoping Textbox1 reads command_width 0, 2 respectively? Looks like you will need different Textboxes for each CheckBoxes (i.e. TextBox1 for CheckBox1, TextBox2 for CheckBox2). I think I would need to write it as such in VB 6. I could be wrong for VB 2005, will leave it to professionals...
Apr 3 '07 #6

Expert 5K+
P: 8,434
Any time you place a value in a textbox (or a variable, or generally just about anything) it will replace the prior value.

What that means is that if you want to achieve the effect of adding something onto the existing value, the new value that replaces it must include the old one. I'll show you what I mean. Consider these two pieces of code...
Expand|Select|Wrap|Line Numbers
  1. Dim s As String
  2. s = "ABC"
  3. s = "DEF"
  4. s = "GHI"
This will produce the value "GHI" in variable s.
Expand|Select|Wrap|Line Numbers
  1. Dim s As String
  2. s = "ABC"
  3. s = s & "DEF"
  4. s = s & "GHI"
This will produce the value "ABCDEFGHI" in variable s.

Sticking strings together in this way is generally referred to as "concatenating" them.
Apr 3 '07 #7

Post your reply

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