Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 293
Default Disappering CommandButton Doesn't

Greetings,

I have a CommandButton on a UserForm that is supposed to become not
visible if a TextBox has anything in it. It stays visible no matter
what is in the TextBox. Here is the code I am using:
__________________________________________________ _______________
Public Sub I3Refresh()
Dim i As Integer

'Reload all TextBoxes from the value in I_3.List(I_3.ListIndex, 1)
'when I_3 changes
For i = 1 To 105
Select Case i
Case 2 'Invoice number
I_2 = I_3.List(I_3.ListIndex, 1)
Select Case I_2.Value
Case vbNullString 'Invoice number is NOT present
MsgBox "I_2 is Empty" & I_2
btnNextInvNumber.Visible = True
Case Else 'Invoice number is present
MsgBox "I_2 Has A Number" & I_2
btnNextInvNumber.Visible = False '<<<<<<<<<
MsgBox "Next Invoice Number should be invisible"
End Select
Case 3 'Special case
CRefName.Value = _
I_3.List(I_3.ListIndex, 2)
Case Else 'Normal data transfer
Me.Controls("I_" & i) = _
I_3.List(I_3.ListIndex, i - 1)
End Select
Next i

End Sub
__________________________________________________ _______________

If anything is in the TextBox called I_2 then the CommandButton
(btnNextInvNumber) which is sitting in the same space as the TextBox
needs to become not visible so that the user can see the Invoice
number. And if the TextBox has nothing to show, then the empty
TextBox should be covered with the CommandButton, until there is
something in the TextBox.

The MsgBoxes on either side of the visible code both fire at the
appropriate times, the visible code doesn't seem to fire!!!

Does anyone see anything that could be wrong with this line?

btnNextInvNumber.Visible = False

I rechecked the name of the button and it is correct.

Any help would be greatly appreciated.

-Minitman
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default Disappering CommandButton Doesn't

Hello
Where did you put your code module or userform?
Anyway, I would recommend you fully qualify your control in the code.
eg:
UserForm1.btnNextInvNumber.Visible = False

HTH
Cordially
Pascal

"Minitman" a écrit dans le message de news:
...
Greetings,

I have a CommandButton on a UserForm that is supposed to become not
visible if a TextBox has anything in it. It stays visible no matter
what is in the TextBox. Here is the code I am using:
__________________________________________________ _______________
Public Sub I3Refresh()
Dim i As Integer

'Reload all TextBoxes from the value in I_3.List(I_3.ListIndex, 1)
'when I_3 changes
For i = 1 To 105
Select Case i
Case 2 'Invoice number
I_2 = I_3.List(I_3.ListIndex, 1)
Select Case I_2.Value
Case vbNullString 'Invoice number is NOT present
MsgBox "I_2 is Empty" & I_2
btnNextInvNumber.Visible = True
Case Else 'Invoice number is present
MsgBox "I_2 Has A Number" & I_2
btnNextInvNumber.Visible = False '<<<<<<<<<
MsgBox "Next Invoice Number should be invisible"
End Select
Case 3 'Special case
CRefName.Value = _
I_3.List(I_3.ListIndex, 2)
Case Else 'Normal data transfer
Me.Controls("I_" & i) = _
I_3.List(I_3.ListIndex, i - 1)
End Select
Next i

End Sub
__________________________________________________ _______________

If anything is in the TextBox called I_2 then the CommandButton
(btnNextInvNumber) which is sitting in the same space as the TextBox
needs to become not visible so that the user can see the Invoice
number. And if the TextBox has nothing to show, then the empty
TextBox should be covered with the CommandButton, until there is
something in the TextBox.

The MsgBoxes on either side of the visible code both fire at the
appropriate times, the visible code doesn't seem to fire!!!

Does anyone see anything that could be wrong with this line?

btnNextInvNumber.Visible = False

I rechecked the name of the button and it is correct.

Any help would be greatly appreciated.

-Minitman



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 293
Default Disappering CommandButton Doesn't

Found it!!!

One of the logic chains got twisted

Found it when I added more MsgBoxes around every time that the button
was mentioned. I then ran the code noting when the button was and was
not visible. I found the bad section and corrected it and now it
works.

There was no problem with the code I had posted, it was in a different
section that I had forgotten about. (I just hate growing old!!!)

-Minitman


On Wed, 01 Oct 2008 00:59:21 -0500, Minitman
wrote:

Greetings,

I have a CommandButton on a UserForm that is supposed to become not
visible if a TextBox has anything in it. It stays visible no matter
what is in the TextBox. Here is the code I am using:
_________________________________________________ ________________
Public Sub I3Refresh()
Dim i As Integer

'Reload all TextBoxes from the value in I_3.List(I_3.ListIndex, 1)
'when I_3 changes
For i = 1 To 105
Select Case i
Case 2 'Invoice number
I_2 = I_3.List(I_3.ListIndex, 1)
Select Case I_2.Value
Case vbNullString 'Invoice number is NOT present
MsgBox "I_2 is Empty" & I_2
btnNextInvNumber.Visible = True
Case Else 'Invoice number is present
MsgBox "I_2 Has A Number" & I_2
btnNextInvNumber.Visible = False '<<<<<<<<<
MsgBox "Next Invoice Number should be invisible"
End Select
Case 3 'Special case
CRefName.Value = _
I_3.List(I_3.ListIndex, 2)
Case Else 'Normal data transfer
Me.Controls("I_" & i) = _
I_3.List(I_3.ListIndex, i - 1)
End Select
Next i

End Sub
_________________________________________________ ________________

If anything is in the TextBox called I_2 then the CommandButton
(btnNextInvNumber) which is sitting in the same space as the TextBox
needs to become not visible so that the user can see the Invoice
number. And if the TextBox has nothing to show, then the empty
TextBox should be covered with the CommandButton, until there is
something in the TextBox.

The MsgBoxes on either side of the visible code both fire at the
appropriate times, the visible code doesn't seem to fire!!!

Does anyone see anything that could be wrong with this line?

btnNextInvNumber.Visible = False

I rechecked the name of the button and it is correct.

Any help would be greatly appreciated.

-Minitman


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 293
Default Disappering CommandButton Doesn't

Hey Pascal,

Thanks for the reply. It is appreciated.

I found the problem as noted in my second post on the thread. I see
that we both posted at same time. :^}

-Minitman



On Wed, 1 Oct 2008 08:55:21 +0200, "papou"
wrote:

Hello
Where did you put your code module or userform?
Anyway, I would recommend you fully qualify your control in the code.
eg:
UserForm1.btnNextInvNumber.Visible = False

HTH
Cordially
Pascal

"Minitman" a écrit dans le message de news:
...
Greetings,

I have a CommandButton on a UserForm that is supposed to become not
visible if a TextBox has anything in it. It stays visible no matter
what is in the TextBox. Here is the code I am using:
__________________________________________________ _______________
Public Sub I3Refresh()
Dim i As Integer

'Reload all TextBoxes from the value in I_3.List(I_3.ListIndex, 1)
'when I_3 changes
For i = 1 To 105
Select Case i
Case 2 'Invoice number
I_2 = I_3.List(I_3.ListIndex, 1)
Select Case I_2.Value
Case vbNullString 'Invoice number is NOT present
MsgBox "I_2 is Empty" & I_2
btnNextInvNumber.Visible = True
Case Else 'Invoice number is present
MsgBox "I_2 Has A Number" & I_2
btnNextInvNumber.Visible = False '<<<<<<<<<
MsgBox "Next Invoice Number should be invisible"
End Select
Case 3 'Special case
CRefName.Value = _
I_3.List(I_3.ListIndex, 2)
Case Else 'Normal data transfer
Me.Controls("I_" & i) = _
I_3.List(I_3.ListIndex, i - 1)
End Select
Next i

End Sub
__________________________________________________ _______________

If anything is in the TextBox called I_2 then the CommandButton
(btnNextInvNumber) which is sitting in the same space as the TextBox
needs to become not visible so that the user can see the Invoice
number. And if the TextBox has nothing to show, then the empty
TextBox should be covered with the CommandButton, until there is
something in the TextBox.

The MsgBoxes on either side of the visible code both fire at the
appropriate times, the visible code doesn't seem to fire!!!

Does anyone see anything that could be wrong with this line?

btnNextInvNumber.Visible = False

I rechecked the name of the button and it is correct.

Any help would be greatly appreciated.

-Minitman



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Ref Commandbutton WLMPilot Excel Programming 0 February 20th 08 03:09 PM
Ref Commandbutton WLMPilot Excel Programming 0 February 20th 08 02:51 PM
how to get commandbutton name Sean Excel Programming 2 October 17th 06 08:49 AM
Wrapped text disappering in Excel 2003 shonnahs Excel Discussion (Misc queries) 2 August 23rd 06 07:10 PM
Commandbutton alvin Kuiper Excel Programming 6 November 27th 05 06:28 PM


All times are GMT +1. The time now is 07:22 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"