Connecting Tech Pros Worldwide Help | Site Map

A Hand Would Be Nice

Newbie
 
Join Date: Apr 2007
Posts: 3
#1: Apr 3 '07
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
Moderator
 
Join Date: Oct 2006
Location: Australia
Posts: 7,748
#2: Apr 3 '07

re: A Hand Would Be Nice


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?
Newbie
 
Join Date: Apr 2007
Posts: 3
#3: Apr 3 '07

re: A Hand Would Be Nice


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
Dököll's Avatar
Moderator
 
Join Date: Nov 2006
Location: Upstate NY - US
Posts: 2,264
#4: Apr 3 '07

re: A Hand Would Be Nice


Quote:

Originally Posted by caek

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!
Newbie
 
Join Date: Apr 2007
Posts: 3
#5: Apr 3 '07

re: A Hand Would Be Nice


Quote:

Originally Posted by Dököll

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!
Dököll's Avatar
Moderator
 
Join Date: Nov 2006
Location: Upstate NY - US
Posts: 2,264
#6: Apr 3 '07

re: A Hand Would Be Nice


Quote:

Originally Posted by caek

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...
Moderator
 
Join Date: Oct 2006
Location: Australia
Posts: 7,748
#7: Apr 3 '07

re: A Hand Would Be Nice


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.
Reply