NavigationControl change Tab Programatically in Access - vba

(MS Access 2016) I'm trying to change the selected tab on a NavigationControl on another form. This is my forms structure:
frm_nav > navSubForm(displaying: "frm_src_ma") > reSubForm ; reSubMenu
navSubForm: name of the Sub Form Control on frm_nav
reSubForm: name of the Sub Form control of the NavigationControl on frm_src_ma
reSubMenu: name of the Navigation Control on frm_src_ma
Now there are two tabs on reSubMenu:
Data [navData ("frm_subsrc_ma")]
Instances [navInstances ("frm_subinst_ma")]
On a floating form i have a button that when clicked i want reSubMenu to change tabs to Data whenever Instances is selected.
This is the code inside the Click Event on said button:
Forms![frm_nav]![navSubForm].SetFocus
DoCmd.BrowseTo ObjectType:=acBrowseToForm, _
ObjectName:="frm_subsrc_ma", _
PathToSubformControl:="frm_nav.navSubForm>frm_src_ma.reSubForm", _
DataMode:=acFormEdit
When either Data or Instances is selected and the button is pressed it throws this error:
The macro action BrowseTo requires a valid Path argument
Screenshots for reference:
Error being displayed

It seems that the problem had to do with what was being focused before applying BrowseTo.
For the full path to be valid, the main form was focused instead of any subform inside it.
Forms![frm_nav].SetFocus
DoCmd.BrowseTo ObjectType:=acBrowseToForm, _
ObjectName:="frm_subsrc_ma", _
PathToSubformControl:="frm_nav.navSubForm>frm_src_ma.reSubForm", _
DataMode:=acFormEdit

Related

How to hide context menu item when mouse out on grid

I am using windows forms with vb.net. This form has infragistics ultra win grid. with context menu item. The item name is "Delete Item". But when the user performs mouse out from grid i want to hide context menu item and when user hover back to the grid i want to show the context menu item. How can i do this.
Step 1) write code to handle the 'BeforeToolDropdown' event
example method signature:
Private Sub ultraToolbar_BeforeToolDropdown(sender As Object, e As
BeforeToolDropdownEventArgs) Handles ultraToolbar.BeforeToolDropdown
Step 2) this gets you a very important eventArgs object. Check to see if the click occurred in the Ultragrid
If IsNothing(TryCast(e.SourceControl, UltraGrid)) Then
Step 3) Finally you want to disable the PopupMenuTool
Dim p As PopupMenuTool = CType(utb.Tools("key"), PopupMenuTool)
p.InstanceProps.Visible = DefaultableBoolean.False
Note: in the example, the PopupMenuTool was located on an UltraToolbarsManager

VB.net how to get the value from my user control textbox

I do have a project for daily monitoring, and I have a problem getting the text from my textbox wherein my textbox is in my usercontrol.
the scenario would be, if I click the show button, the userControl.vb would be called in my panel and I dont have a problem putting up userControl.vb to my panel, if I click save button which will check if all fields are fill-up before saving the data. I would save as normal and wont check my panel where I load up my userControl.vb
this my snippet project tree:
DXApplication
|_My Porject
|_User Control <folder>
|_userControl.vb <user control form>
|_frmMainActivity <winForm>
here is my code for loading the userControl in my Panel
Friend ctrlUser As UserControl
ctrlUser = New userControlx
ctrlUser.Dock = DockStyle.Top
pnlActivity.Controls.Clear()
pnlActivity.Controls.Add(ctrlUser)
here is code for calling the textbox from userControl from another sub to check if the code can get the text.
*edited the userControl should be userControlx*
Dim uc As New userControlx
Msgbox(uc.txtLatitude.text)
when i hit the trigger button to show what text i put on my textbox i would return msgbox with empty string.
Any suggestion? where did I go wrong on calling the value of the textbox?
I've tried using:
Dim uc As New userControlx
uc.txtLongitude.text = "Test Text"
msgbox(ux.txtLongitude.txt)
It will return the Test Text, But in my UI the textbox that is loaded is empty.
in the trigger button you create a new instance of userControl, thats why the content of your textbox is emtpy
instead use
Msgbox(ctrlUser.txtLatitude.text)

clear label of a form from the button of another form in Visual Basic

First, I apologize for my english, I'm still learning
I have a project in visual basic .net
It has two forms. One is the main and the other are called "details". "Details" must appears when click a label on the main form. When I close "details" form, I need to clear or reset (___.text = "") all the labels inside it. I tryed programming a close button or even in the FormClosing Event but it doesn't work.
The main form has a "New" button that cleans every label and textbox inside it. So I tryed to clear the labels of "Details" form from this button (Form2.Label1.Text = ""). But it doesn't work.
If I click "New" and then I click "Details" to open Details form, the labels had the old values. I need it clean.
Thanks
Display your "Details" Form with ShowDialog() instead of Show(), then call the PerformClick() method of your "New" Button:
' ... from within the "Main" Form ...
Dim details As New frmDetails
details.ShowDialog() ' <-- code STOPS here until "details" is dismissed
btnNew.PerformClick() ' now click the "New" button

Call screen on button click?

I have a mainscreen with a few buttons in it and I'm trying to assiciate each button with a screen call. I can't get it to work though. I created the button with the layout painter but I don't see how to make it functional.
Any ideas? Thanks!
open the screen painter
double click on the button
enter a Function Code (the field is above "Context Menu Form")
now that your button has a function code it will fire this OK-Code and the dynpros "PROCESS AFTER INPUT" will be run. add a PAI module to the dynpro and in the module you could for example make the following coding:
case sy-ucomm. " the ok code
when 'your_buttons_function_code_here'.
call screen YOUR_SCREEN_NUMBER_HERE.
when others.
" DO NOTHING
endcase.
You must create a screen & perform CALL SCREEN inside that event. There's a concept called PAO & PBO. You may refer that too. Few links for your reference..
http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbab2935c111d1829f0000e829fbfe/content.htm
http://www.abapprogramming.net/2008/04/sap-abap-syntax-for-call-screen.html

vb.net tabpage using a form for tabpanels issues

I have a simple vb.net form a tabpanel strip, and then a seperate form which is loaded for the tabpage.
Here is the code for the button that dynamically creates new tabs:
Dim tempTab As New TabPage
initTab(tempTab)
xt.TabPages.Add(tempTab)
xt.SelectedIndex = xt.TabCount - 1
Here is the code for the "initTab":
Dim tmpTab As New MainTab
tmpTab.Dock = DockStyle.Fill
tmpTab.Panel1.Dock = DockStyle.Fill
tab.Controls.Add(tmpTab)
tab.Text = "Untitled"
tab.Name = " "
I can easily set the focus of any tab by entering following which sets the focus for example to the last tab:
xt.SelectedIndex = xt.TabCount - 1
Now the issue is, how can I set the focus to a textbox on the custom form (in my example labeled "MainTab")? I've tried virtually everything I can google and I can't seem to find any example of how to setfocus or even set/get anything from the MainTab form.
Anyone can help me?
Erm, turning a form into a child control takes some surgery. You have to set its TopLevel property to false, hide the border, make it visible. I don't see it in the code snippet, is MainTab actually a form?
Anyhoo, you cannot use the Focus() method on a control until it is visible. Odds are good that it isn't visible yet in your code snippet. Use the Select() method instead. Say:
tmpTab.TextBox1.Select()
Or just set the TabIndex property of the first control that should get the focus to 0 in the designer.
xt.Controls(xt.SelectedIndex).Controls("TEXTBOXNAME").Focus()
Just make sure that you set the Name property of the textbox you want to have focus (in this case the name would be TEXTBOXNAME) if you do it like this.