Tooltip on combox Item - c#-3.0

I want a tool tip on the drop down list for combox items. I have a combobox and showing combobox item in that combobox on selected index change of drop down, but it is note helping me too much.
Since my dropdown size is small, and items in the dropdown are very big, it's become difficult for users to select the proper value by seeing this.
If tooltip shown on the individual item, it could be very useful.
If any budy knows answer , Please reply.

Use the ToolTip class for this. An example in code would be:
ToolTip toolTip = new ToolTip();
toolTip.Show(comboBox1.SelectedItem.ToString(), comboBox1);
You can then tie this code to the comboBox1_SelectedIndexChanged event handler.
NOTE: Your ComboBox name may differ from mine.

Related

How do I set size of colums in a table subform datasheet view in MS Access

I have a subform bugging me. The mainform contains buttons etc. Everytime the user close/open the form, the columns width is reset to whatever the table likes. If i open the table directly, the size is as i want. If i change it in the subform, it is not saved. (See screendump)
I would like "Phase" to stay about 2 cm width. I can enter the subform and edit the "Width" but that is only applied to the other views.
I hope you can help, Emil.
I realize this post is almost 2 years old, but I ran into the same problem and came across this post.
I am running MS Access 2013 on Windows 7 Ultimate. I did not find the solutions offered here to work for me, so, I set out to find something that would work for me before I went to VBA code. (Incidentally, I appreciate the link offered by #Patrick_Honorez in his comment on the original post because that was going to be my fall-back solution.)
Anyway, here is what worked for me and I hope perhaps it will work for others as well:
Open the parent form.
In the subform, right-click the column header
for the column for which you wish to adjust the width.
Select the “Field Width” item from the context menu.
In the “Column Width” dialog that appears in step 3, enter the desired column width in points, or, use the [Best Fit] button. Then click the [OK] button to close the dialog and return to the form.
Right-click the parent form’s border to bring up the parent form’s context menu. Click the “Save” item in the context menu.
Now close the parent form.
The next time the form is loaded, the column widths should be as set it step 4 above--at least they are for my setup.
I see this post is quite old and OP must have figured someway to tackle the issue. I came across same issue today and found solution on this link.
For anybody else having same issue, use following code (I modified the code a little because original code from the above mentioned post saves column width of only text boxes but my form has combo boxes too, column width of which was not getting saved) in close and open events of your subform and then open main form in Form View and then manually select desired widths either by mouse, by entering column width value or using best fit. Save the form and reopen to check results. That's it.
Private Sub Form_Close()
Dim ctrl As Control
For Each ctrl In Me.Controls
If (ctrl.ControlType = acTextBox Or ctrl.ControlType = acComboBox) Then
SaveSetting "propertiesDBS", Me.Name, ctrl.Name, ctrl.ColumnWidth
End If
Next
End Sub
Private Sub Form_Open(Cancel As Integer)
Dim ctrl As Control
Dim frm As Form
Dim w As Long
For Each ctrl In Me.Controls
If (ctrl.ControlType = acTextBox Or ctrl.ControlType = acComboBox) Then
w = GetSetting("propertiesDBS", Me.Name, ctrl.Name, 0)
If w <> 0 Then ctrl.ColumnWidth = w
End If
Next
End Sub
I know this is late to the party and most likely going to be the last comment anyone reads, but this can be done quite simply in MS Access 2016 - by someone like myself who has no more than 4 days experience in databasing overall and no experience with writing custom Macro's or VB Script (using only what is native to MS Access).
Here's how I did it.
Scenario - Split Form (Form + Datasheet).
Extra Recommendations:
It pays to be across all properties of every object type in your database, as a change in a field property can cause unpredictable erratic effects, which take ages to figure out why it happened and how to stop it from happening again, whilst delivering your desired outcome.
Me.Requery in your VBA script after every necessary event and also in your main form (generally the 'After Update' event is used most), and be wary that too many Me.Requery's (in unnecessary events) can also be detrimental - so too much of a good thing can be a bad thing.
Bottom Line Up Front - Modify the format of your query that is to be exported/printed.
In 'Design View' of the query you are concerned with, ensure that the fields are in the order you need them outputted in first as this is exactly how the macro will present them for export/print (example could be "Australia" then "Northern Territory" then "Town's In The Northern Half Of The State" then "Darwin" then "Suburbs In The Northern Half Of City").
Switch to 'DataSheet View' in the same query and use the top left folded over triangle looking thingy to highlight the entire data set then right click that same triangle to present an options menu. Select 'Row Height' and type in "15" (default row height in Excel).
Deselect the entire spreadsheet and this time select every column (left click the left most column, hold shift button, scroll over to the right to the far end of the data set and click the last column) and then right click one of the highlighted columns to present another menu. Select 'Field Width' and within that new pop-up menu select 'Best Fit' and then 'OK'.
(Optional - not sure if this helps or hinders but I did it for my purpose) With the columns still selected right click one of the highlighted columns again and select 'Freeze Fields'.
My scenario had buttons with macros configured to run filtered reports so I was able to check this by simply clicking any of those buttons and seeing the report formatting, which it held true to the work I had just done. I exported using another button with a macro that exports to Excel with 'Print Formatting' selected (my main form also had the datasheet view as the only thing that could be printed and was also set in 'Print' formatting.
The Excel spreadsheet opened with all row heights and column widths in a way that I could read every field/record with perfect ease and without extra modification.
This also worked for cascaded combo boxes, with the export only outputting the 'drilled down/filtered' datasheet records, in a format that required no further modifications.
Hope this helps someone, as its saved my hide! :)
Open the Main form in Design. Go to the SubForm. Click on the square at the top left of the SubForm and select 'Properties'. Right-Click the control 'Phase' and click 'Properties'.Click the 'Format' tab and select 'Width'. What do you see there? That should control the widht of control 'Phase' unless you have some overriding coding elsewhere. Input the size you want and see what happens.
Use continuous forms instead. It gives you complete control over how your subform displays.
If you open your subform directly, your property sheet menu should display automatically if the default view is "Datasheet." Click on "All" and change the "Auto Resize" property to "No." This should solve the issue and avoid the need for VBA.
This only works when you open the subform separately. So if you want the changes to be reflected within your main form, you'll have to close it and switch back and forth.
Super annoying by default.
It seems to work as one would expect of you set the view mode to layout view. Drag column widths as needed and save. Go back to form view and it works. It's really dumb it doesn't work the same way in form view our design view.
In Access 365, open main form, right-click sub-form datasheet columns that need width adjustment, use the Field Width to adjust, click on border of main form to select Layout view, and save changes.
Open subform in datasheet view (by double click on subform in the left pannel)
Resize columns as you want by dragging or by right-click the column header for the column for which you wish to adjust the width and select the “Field Width” item from the context menu.
Right-click the subform border to bring up the context menu. Click the “Save” item in the context menu.
Either open the Main Form in Layout View or directly open your Subform in Datasheet View. Right Click on the Field Header, select Field Width, and enter the desired width. Save. Bewm.
My solution (Access 2016) was to create the main & subform, recreate the subform on its own using form wizard and set it up the way I want it, rename the original subform to something else, and finally rename the recreated subform to the original form name. Open the main form and the subform should be laid out the way you want it. You can then delete the original subform you renamed.

delete selected item from text item

i have got multi lined text item like gridview in my forms project. i want to select an item and click delete button and the system must delete selected index but i didnt find the perfect function. it's not bind into the database so its not complicated i just want to delete the line from the text item. i tried to find the properties of the current record, i use some of loops but it didnt find the selected item index. does it have "selected item" function like c#, java. Or do i have to create a function to find selected item. which way is the best and how could i do that.
This code may help you(I didn't get a chance to test this) :
GO_BLOCK('Gridview_BLOCK_NAME');
GO_RECORD(record_index);
DELETE_RECORD;
GO_ITEM('block.delete_button');--if you want the cursor back to delete button

EXTJS Combobox : show only NONselected values in dropdownlist for each combo-selection

i have an combobox in a gridcolumn and the requirment is to show only nonselected values in the dropdown list for the next combo selection
One possibility is to use the superselectbox. If you want to customize the standard combobox, you can take a look at the superselectbox source code - it is actually extended combobox.

In GWT need to set the value of list box to the one,that was was selected in other selection

I have a full search panel with listbox whose value are read from DB.when a item in listbox selected and search is made.If the results are not found the search panel is condensed (one more search panel) and in condensed search ,we can change the search criteria ,selected a different item in the list box .after changing the search criteria and if search is made ,when the full search panel appears,the value of the list box in full search panel should be same as the one changed/selected in the condensed search panel.
How can we accomplish this.
In simple - If i have two list boxes, load a list box and set the value of the listbox same the other listbox.If value of one listbox is changed, the other should be changed and the value of this listbox is set with the value selected in the previous one.
I would do the following
//you have something like this
ListBox listbox1;
ListBox listbox2;
//add a change handler
listbox1.addChangeHandler(new ChangeHandler() {
#Override
public void onChange(ChangeEvent event)
{
int index = listbox1.getSelectedIndex();
//do your update code here for listbox2
//like a listbox2.setSelectedIndex(index) or something
}
As far as I see its an easy implementation. Add a value change handler on the first listbox and do whatever you want in onChange method.
Regarding your panel need to be collapsed when there is no search results, you can always use vertical panel and set its height to 100% and add another panel to it or Use Dock Panel and add panels to south or best use disclosure panel and play around with it.

DataGridViewComboBoxCell selectioindexchange event

I have a data-grid and three column in it. one column is type of DataGridViewComboBoxCell, three items are in this grid combo box, now i have to invoke selection index changed event to change value according to combo value change in grid.
also help me to make a new event ....
please help...
thanks
I really can't understand your question.
But maybe these informations can help:
A ComboBoxColumn has always two kinds of controls. A presenting one (in most cases a label) which is individually for each row. And a editing one that will be shared for the whole column. So take a look into this documentation and the IDataGridViewEditingControl Interface.
Maybe these will give you a starting point on how to solve your problem.
In the Load event for the form, you need to get the cell that you want to add the handler to and cast it as a regular combo box. You can then add the event handler on SelectedIndexChanged, but it must be done programmatically, and depending on the language you are using.