How to access textbox's select function in Autocompletebox - windows-phone-8

I am trying to place the cursor at the end of the text in textbox inside Microsoft.Phone.Controls.AutoCompleteBox.
how can i do this?
It is strange that AutoCompleteBox has Focus function but no function for Select.

It's pretty much explained on this blog
Basically, it comes down to getting the inner TextBox
var textbox = GetTemplateChild("Text") as TextBox;
And then from there you can easily do whatever you would otherwise do with a TextBox.

Related

Update result of formula in text box

I'm trying to update an unbound text box in a form I'm building.
The text box has a default value which is: =DLookUp("[Metadata]![Username]";"[Metadata]").
When the value in the field username is changed;
how do I update this change in the text box without closing the whole form and then opening it again?
--
I've tried to to do this by adding a button in the form and then on mouse up event try and either by vba or the macro editor find a solution.
It would supposedly be possible to create a macro that will close and then open the form again but it's not really what I'm looking for.
VBA: I found lots of suggestions for requery but I couldn't get this to work:
Set UserName = Forms![Update test]!Text10
UserName.Requery
A general solution that could work with multiple such text boxes is preferable
(but not required, anything that tries to point me in the right direction is welcome).
Go to the design view and select the textbox which represents your table value username, then go to events and select the On Change() event:
Private Sub username_Change()
YourTextbox.Value =DLookUp("[Metadata]![Username]";"[Metadata]")
End Sub

MS Access de-select listbox after running macro/query

So I have a form (frmBookingForm) in Access, and a listbox (lstMyBookings) that displays the results of a query.
Below this, I have a button (cmdDeleteBooking) which runs a delete query using the lstMyBookings selection as input. The button then runs a macro that firstly checks whether a record in the listbox is selected, and if one is, runs the delete query and requeries the data, so the deleted record is no longer shown in the listbox. If not, an error message is displayed.
However, if I then click the button again, it again runs the delete query, even though there is apparently nothing selected in the list box.
Essentially, how can I 'clear' the listbox selection?
I'd prefer a solution that can be done in a macro format, as I have little to no understanding of VBA. However, if providing a VBA solution, I'd greatly appreciate a short explanation of it.
Thanks :)
Looks like this website has a nice little function to do it. Essentially, you need to test if it's a multiselect, and then do one of two things. I suppose if you know ahead of time that it is/isn't a multiselect, you wouldn't even need the "if" statement:
If List0.MultiSelect = 0 Then
List0 = Null
Else
For Each varItem In List0.ItemsSelected
List0.Selected(varItem) = False
Next
End If
If the control's MultiSelect property is set to None, this code just sets List0 to Null. If the control's MultiSelect property is set to anything else, the code loops through all items that are currently selected, and sets the Selected property of that item to False. My example assumes your control is called List0.
EDIT
To use this code, use an event instead of a macro. Here's how you do this:
Right click on the button, select properties
In the Property Sheet window, click on the "Event" tab
Click inside of the "On Click" blank area, and click the dropdown arrow, then select "[Event Procedure]"
Click the ellipsis ("...") to go into the code editor.
In the code editor, your should already have your event for the button (let's assume the button is called Command1:
Private Sub Command1_Click()
End Sub
Add your code in between (assuming the listbox is called List0):
Private Sub Command1_Click()
If List0.MultiSelect = 0 Then
List0 = Null
Else
For Each varItem In List0.ItemsSelected
List0.Selected(varItem) = False
Next
End If
End Sub

how to clear text box inside a macro?

I have a macro for onclick event for a combo, how do i have something to clear the text box in the same form when the user click on combo box and make selection. I would like to do the clear inside the same macro rather than a procedure.
Not clear what you mean by macro? Do you mean the new macro language in Access, or do you mean VBA code?
In VBA code you can just go:
Me.MyComboBox = null
In macro code, you use SetProperty, input the name of your Control, set the Property to "Value" and just leave the Value blank.

I would like a new text box comes out when someone clicks on others

I have a form in access that dropdown box. Now what I want is when someone choose others from the dropdown box, a new text box shows up to allow the user to type. Anyone help please thank y ou
Assuming your DropDown is called Combo1 and on the same form you have a textbox called Text1 and the value of "Others" is also "others". Then you just need to code the Combo1's Change event like so
Private Sub Combo1_Change()
Me.Text1.Visible = (Me.Combo1.Value = "others")
End Sub

How to make TextBox visible after an item in an option group is selected

This should be easy but for some reason it will not work. I have a form named MainForm and the selection in the Option Group I want to select is called PickMe.
I have a text box called TxtHere that I set to not be visible.
I wrote this:
Private Sub PickMe_Click()
Me!TxtHere.Visible = True
End Sub
So it should set the text box to visible when I select PickMe but this does not work. Any ideas? I feel stupid for asking something so simple.
Er, with an option group, you should use the AfterUpdate() event of the option group, and then use a SELECT CASE to test the value returned by the option group.
I figured it out.
With a Option Group use:
_MouseDown and Me.xxx.Visible = True