Accessing controls that were moved - vb.net

I am returning to coding after a long hiatus, and have come across a tiny issue that has me baffled. What I'm trying to do is simple, and it worked perfectly until I copied the controls from the winform and placed them in a tab control.
Very simply, I have a yes/no combobox with a conditional statement making a date time picker visible if the combobox is set to "Yes". Since moving the controls into a tabcontrol (The project had so many controls, I had to condense them for space). What's really crazy is I have a subroutine that resets all the controls in the project, and it still works.
when it worked, it looked like this:
If cmbAssessment.SelectedIndex = 1 Then
dtpAssessment.Visible = True
End if
(TabControl is named tcNursing and form is frmNursing)
I just can't figure out how to reference these controls inside the Tab Control.
It seems like solutions from Googling the issue are very complex. I'm finding it hard to believe this is
a complex problem. Thank you for ANY assistance at all!

As it turns out, Jimi, you were on the right track. There was nothing obviously wrong with the event handlers, although deleting them and re-adding them solved the problem. Thank you all for your help in this matter!

Related

xaml automatic align of a textbox inside a RelativePanel

I have a TextBox inside a RelativePanel in a universal Win App in C# (XAML/vs2015).
I want the textbox to be always on the right end of the panel, even when the form size changes.
Please tell me how to do that
thank you
Well since the generic answer did the trick without needing any further detail, might as well enter it as an answer so other viewers know you got sorted and skip the question.
Since it's a child of the RelativePanel you need to supply the declaration to the element, in this case TextBox using the bool property set to true of;
RelativePanel.AlignRightWithPanel="True"
Glad you got a remedy, have a great weekend!

MS Word RibbonX How can I dynamically populate a combobox when a dotm file opens?

I'm a little stumped here. I'm diving deeper into designing ribbons for MS Word 2010, and I came across something new: populating comboboxes on the fly. In the image below, you can see...
...that I'm a dude who likes music while he works, just like any other dude. Problem is my list of playlists changes from time to time, so I don't want to hard-code that list into my ribbon's combobox. I can easily hard-code it, but I want this thing to be dynamic. And so, in my ribbon code:
<comboBox id="cmbPLaylist" label="Playlist" getItemLabel="Document_Open">
<item id="none" label="None"/>
</comboBox>
I have left only one item, "none," which is fine if I want the music player to launch with no playlist loaded. But what if I want a playlist to automatically load?
First, from my Google and book research, I've determined that I need to have a getItemLabel callback to populate the control. Is this the right way to go? But how do I run that automatically when my Normal.dotm loads? I'm having problems running this thing in the Document_Open event, and I've been reading online that I'm not alone.
My problem is a bit threefold: first, I'm really new at using these predefined callbacks like getEnabled, getItemLabel, etc. The callback territory is a very new territory for me. Second, I've never used a combobox in a ribbon before. Three, I've never dynamically populated a combobox in a ribbon before. I might be trying to bite off more than I can chew at once, but can anyone point me in the right direction?
My code so far, inserted into my Normal.dotm Document_Open event, is such:
Private Sub Document_Open(control As IRibbonControl, ByRef label)
Dim ListOfPlaylists() As String
ListOfPlaylists = GetPlaylists()
ListOfPlaylists(UBound(ListOfPlaylists)) = "Random"
End Sub
After this, I'm stumped. As you can see, I'm not sure how to tell MS Word, "Hey, MS Word, insert this value into the combobox list!"
Maybe it's my newbness at this whole thing, but when I Google for an answer, I'm not seeing it in the code. So any help is appreciated. Thanks!
I actually did some fiddling and almost stumbled on the answer. I put this in my code and it seems to work just fine now:
Sub drpPlaylists_getItemCount(Control As IRibbonControl, ByRef drpPlaylists_itemCount)
drpPlaylists_itemCount = UBound(ReadDirectoryContents(MusicDirectory, "*.m3u"))
End Sub
I guess this gets launched every time the ribbon has to reload itself. But it's solved for now. Still have some things to study up on on when these callbacks get called, but I'll figure this out. Thanks for the help!

Visual Studio Form Designer changes layout of controls on open

I have a user control that looks like this in the designer:
However, when I close the designer and open it again, it looks like this:
The eight controls that have moved are text boxes and labels that are all set to Anchor Top, Right while all the other controls have different anchoring.
Does anyone have any idea what is causing this change of layout, and more importantly, how it can be prevented?
I also had the problem of changing the layout of my form every time by opening it in design mode.
The problem was the use of the tool "TableLayoutPanel".
By coincidence I found that changing the property "Dock" solved the problem.
Just set to another value and then undo this.
After this is seems to be solved. Don't ask me why!

Adding programmatically a control on top of others

I'm looking for adding a control on top of others controls during runtime.
I read that the only way of playing with the Z-Order of controls is by playing with the order of the controls inside the Form.Controls Collection. I find this solution very weird and weak and I'm looking for an alternative.
Does anyone has an idea? I just want to make some kind of modal dialog that'll show below another user control to notice the user that the user control is currently doing something.
Edit: I tried using Control.BringToFront() but it doesn't work at all.
Thanks a lot!
You're looking for the BringToFront() method.

Tab Controls effecting other Controls

Hopefully I've explained myself good enough this time. Can't seem to get a real answer. Trying to make it so when I select certain tabs, certain controls on the left will disappear or reappear.
http://img43.imageshack.us/img43/7533/scrnshotg.jpg
Also, when "Stats" is selected, I need it to auto-select "Frequency"
Ex. On click/focus/select (whatever, nothing seems to work)...
ComboBox.Visible = True
Thank you.
Handle the TabControl.TabIndexChanged event.
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.tabindexchanged%28v=VS.100%29.aspx