کلینیک فوق تخصصی اکسس ( کاربرد vba در اکسس )

کلینیک فوق تخصصی اکسس ( کاربرد vba در اکسس )

به اشتراک گذاری اطلاعات کسب شده در اکسس از سایت آفیس و سایت های تخصصی خارجی
کلینیک فوق تخصصی اکسس ( کاربرد vba در اکسس )

کلینیک فوق تخصصی اکسس ( کاربرد vba در اکسس )

به اشتراک گذاری اطلاعات کسب شده در اکسس از سایت آفیس و سایت های تخصصی خارجی

ListBox



Private Const WM_REFLECTNOTIFY As Int32 = & H204E
Private Const NM_FIRST As Int32 = 0 
Private Const NM_DBLCLK As Int32 = (NM_FIRST - 3) 

Dim lNMHDR As NMHDR 
Select Case uMsg 
Case WM_REFLECTNOTIFY
CopyMemory (lNMHDR,LParam, Marshal.SizeOf (lNMHDR)) 

If lNMHDR.code=NM_DBLCLK Then 
' Do Something 
return 
End If 
End Select 


List Box Types and Styles

There are two types of list boxes: single-selection (the default) and multiple-selection. In a single-selection list box, the user can select only one item at a time. In a multiple-selection list box, the user can select more than one item at a time. To create a multiple-selection list box, specify the LBS_MULTIPLESEL or the LBS_EXTENDEDSEL style.

LBS_EXTENDEDSEL
LBS_MULTIPLESEL
LBS_NOTIFY( Causes the list box to send a notification code to the parent window whenever the user clicks a list box item (LBN_SELCHANGE), double-clicks an item (LBN_DBLCLK), or cancels the selection (LBN_SELCANCEL)

LBS_SORT


LB_SETCURSEL message

wParam

Specifies the zero-based index of the string that is selected. If this parameter is -1, the list box is set to have no selection.

lParam

This parameter is not used.


LB_ADDSTRING message

Adds a string to a list box. If the list box does not have the LBS_SORT style, the string is added to the end of the list. Otherwise, the string is inserted into the list and the list is sorted.

Parameters

wParam

This parameter is not used.

lParam

A pointer to the null-terminated string that is to be added.

If the list box has an owner-drawn style but not the LBS_HASSTRINGS style, this parameter is stored as item data instead of a string. You can send the LB_GETITEMDATAand LB_SETITEMDATA messages to retrieve or modify the item data


LBN_SELCHANGE notification code

Parameters

wParam

The LOWORD contains the identifier of the list box. The HIWORD specifies the notification code.

lParam

Handle to the list box.

Remarks

This notification code is sent only by a list box that has the LBS_NOTIFY style.

This notification code is not sent if the LB_SETSEL, LB_SETCURSEL, LB_SELECTSTRING, LB_SELITEMRANGE or LB_SELITEMRANGEEX message changes the selection.

For a multiple-selection list box, the LBN_SELCHANGE notification code is sent whenever the user presses an arrow key, even if the selection does not change.



LBN_SETFOCUS notification code

Notifies the application that the list box has received the keyboard focus. The parent window of the list box receives this notification code through the WM_COMMAND message.

Parameters

wParam

The LOWORD contains the identifier of the list box. The HIWORD specifies the notification code.

lParam

Handle to the list box.


LB_GETCURSEL message

Gets the index of the currently selected item, if any, in a single-selection list box.

Parameters

wParam

Not used; must be zero.

lParam

Not used; must be zero.


Return value

In a single-selection list box, the return value is the zero-based index of the currently selected item. If there is no selection, the return value is LB_ERR.

Remarks

To retrieve the indexes of the selected items in a multiple-selection list box, use the LB_GETSELITEMS message. To determine whether the item that has the focus rectangle in a multiple selection list box is selected, use the LB_GETSEL message.

If sent to a multiple-selection list box, LB_GETCURSEL returns the index of the item that has the focus rectangle. If no items are selected, it returns zero.


LB_GETSELITEMS message

Fills a buffer with an array of integers that specify the item numbers of selected items in a multiple-selection list box.

Parameters

wParam

The maximum number of selected items whose item numbers are to be placed in the buffer.

This means list boxes cannot contain more than 32,767 items

lParam

A pointer to a buffer large enough for the number of integers specified by the wParamparameter.


Return value

The return value is the number of items placed in the buffer. If the list box is a single-selection list box, the return value is LB_ERR.


LB_GETSEL message

Gets the selection state of an item.

wParam

The zero-based index of the item.

This means list boxes cannot contain more than 32,767 items

lParam

This parameter is not used.


Return value

If an item is selected, the return value is greater than zero; otherwise, it is zero. If an error occurs, the return value is LB_ERR.


LB_SETITEMHEIGHT message

Sets the height, in pixels, of items in a list box. If the list box has the LBS_OWNERDRAWVARIABLE style, this message sets the height of the item specified by the wParam parameter. Otherwise, this message sets the height of all items in the list box

Parameters

wParam

Specifies the zero-based index of the item in the list box. Use this parameter only if the list box has the LBS_OWNERDRAWVARIABLEstyle; otherwise, set it to zero.


This means list boxes cannot contain more than 32,767 items.
lParam

Specifies the height, in pixels, of the item. The maximum height is 255 pixels.


نظرات 0 + ارسال نظر
برای نمایش آواتار خود در این وبلاگ در سایت Gravatar.com ثبت نام کنید. (راهنما)
ایمیل شما بعد از ثبت نمایش داده نخواهد شد