C cwt Active Member Licensed User Longtime User Mar 2, 2012 #1 I have a spinner that is already populated from a table. How can I set the selected spinner row to the value of another variable so that after the spinner populates is displays the variable value? The variable value will always be one of the choices in the spinner. Thanks
I have a spinner that is already populated from a table. How can I set the selected spinner row to the value of another variable so that after the spinner populates is displays the variable value? The variable value will always be one of the choices in the spinner. Thanks
A admac231 Active Member Licensed User Longtime User Mar 2, 2012 #2 Code: spinner1.SelectedIndex = spinner1.IndexOf(VariableName) Last edited: Mar 2, 2012 Upvote 0
C cwt Active Member Licensed User Longtime User Mar 2, 2012 #3 What is "Value" and what do I set it to? The compiler is saying it must be an array. Thanks Upvote 0
A admac231 Active Member Licensed User Longtime User Mar 2, 2012 #4 Sorry. Probably should have said this before. Value is a string. So if you had: Code: One Two Three Four And used value = "Two" the spinner will select Two. Upvote 0
Sorry. Probably should have said this before. Value is a string. So if you had: Code: One Two Three Four And used value = "Two" the spinner will select Two.
C cwt Active Member Licensed User Longtime User Mar 2, 2012 #5 Here is what I am doing: I fill the Spinner with text fields from a table. A string variable is set to one of the same values that the spinner is filled with. Then I want the spinner to show the value of the string variable. I must not be understanding something basic here. Sub BuildSpinnerList Dim Cur As Cursor Spinner1.Add("job status list") Cur = Main.SQL1.ExecQuery("SELECT * FROM " & Main.StatusTableName & " ORDER BY Status ASC" ) For i = 0 To Cur.RowCount - 1 Cur.Position = i Spinner1.Add(Cur.GetString("Status")) Next Cur.Close End Sub Let's say one of the values that was added to the spinner was "xyz" Now I set the string variable JobStatus = "xyz" As soon as I set JobStatus to "xyz" I want the spinner to show "xyz" - preselected, so to speak. Thanks Upvote 0
Here is what I am doing: I fill the Spinner with text fields from a table. A string variable is set to one of the same values that the spinner is filled with. Then I want the spinner to show the value of the string variable. I must not be understanding something basic here. Sub BuildSpinnerList Dim Cur As Cursor Spinner1.Add("job status list") Cur = Main.SQL1.ExecQuery("SELECT * FROM " & Main.StatusTableName & " ORDER BY Status ASC" ) For i = 0 To Cur.RowCount - 1 Cur.Position = i Spinner1.Add(Cur.GetString("Status")) Next Cur.Close End Sub Let's say one of the values that was added to the spinner was "xyz" Now I set the string variable JobStatus = "xyz" As soon as I set JobStatus to "xyz" I want the spinner to show "xyz" - preselected, so to speak. Thanks
A admac231 Active Member Licensed User Longtime User Mar 2, 2012 #6 Sorry I was a bit of an idiot there. It should be Code: Spinner1.SelectedIndex = Spinner1.IndexOf(JobStatus) Also, you can give your spinner a title by using Spinner1.Prompt = "Title". I'm assuming that's what you're doing with Spinner1.Add("job status list"). Upvote 0
Sorry I was a bit of an idiot there. It should be Code: Spinner1.SelectedIndex = Spinner1.IndexOf(JobStatus) Also, you can give your spinner a title by using Spinner1.Prompt = "Title". I'm assuming that's what you're doing with Spinner1.Add("job status list").
C cwt Active Member Licensed User Longtime User Mar 2, 2012 #7 that worked - Thanks for the help Upvote 0