|
| |
|
|
|
|
|
|
|
|
|
|
| |
|
|
|
|
|

|

|
|
(Birthday boy: 19-Feb-2005) |
(Inauguration at Micorosft comminity user group
at
Sinhagad College Pune) |
| |
|
|

|
 |
|
(Returning back to home form pune, its dam cool outside) |
(Introducing me) |
| |
|
|

|
 |
|
Center of attraction |
(Hungry Kya?) |
More to Come....
|
| Most of you must have worked on paging feature of DataGrid.
its works fine as long as you have more no of records to show, but if you
have configured 20 records per page and no of records you retrieved is
less then 20 then also pager gets rendered at the bottom of the grid
showing "1". most of us do not bother about it , but Clients ,,,uff...but
after all client is a client...if you also encounter such things this is
how you solve
SQLDataAdapter.Fill(DS,"Emp")
If DS.Tables("Emp").Rows.Count >
MyDataGrid1.PageSize then
MyDataGrid1.AllowPaging = True
Else
MyDataGrid1.AllowPaging = False
End if
MyDataGrid1.DataBind()
I do hate to write these extra lines of code, I hope that .NET team at Microsoft
will incorporate this feature inbuilt in DataGrid itself in their next release.
what do others say...? any better ways?
ya perhaps this could have been reduced to one line also eg.
MyDataGrid1.AllowPaging = ( DS.Tables("Emp").Rows.Count >
MyDataGrid1.PageSize )
Anything better then this? |
|
| Hi Jobery, what you intent to ask me was how can I create a
tray icon in VB6. ( Read
Here)
Windows API Shell_NotifyIcon sends a message to the system to add, modify, or delete
an icon from the taskbar status area
API declaration in VB is as below
Declare Function Shell_NotifyIcon Lib "shell32.dll" Alias
"Shell_NotifyIconA" (ByVal dwMessage As Long, lpData As
NOTIFYICONDATA) As Long
You can get all information of the API declaration with API Text Viewer found in below path
"D:\Program Files\Microsoft Visual Studio\Common\Tools\Winapi\APILOAD.EXE"
Function returns a long type value, If the function succeeds, the return value is nonzero. If the function fails, the return value is zero.
To get extended error information, call GetLastError.
Example code:
Private Type NOTIFYICONDATA
cbSize As Long
hWnd As Long
uId As Long
uFlags As Long
ucallbackMessage As Long
hIcon As Long
szTip As String * 64
End Type
Private Const NIM_ADD = &H0
Private Const NIM_MODIFY = &H1
Private Const NIM_DELETE = &H2
Private Const NIF_MESSAGE = &H1
Private Const NIF_ICON = &H2
Private Const NIF_TIP = &H4
Private Const WM_LBUTTONDBLCLK = &H203
Private Const WM_LBUTTONDOWN = &H201
Private Const WM_RBUTTONUP = &H205
Private Declare Function Shell_NotifyIcon Lib "shell32" Alias "Shell_NotifyIconA"
(ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean
Dim TrayI As NOTIFYICONDATA
Private Sub Form_Load()
TrayI.cbSize = Len(TrayI)
'Set the window's handle (this will be used to hook the specified window)
TrayI.hWnd = pichook.hWnd
'Application-defined identifier of the taskbar icon
TrayI.uId = 1&
'Set the flags
TrayI.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
'Set the callback message
TrayI.ucallbackMessage = WM_LBUTTONDOWN
'Set the picture (must be an icon!)
TrayI.hIcon = imgIcon(2).Picture
'Set the tooltiptext
TrayI.szTip = "Recent" & Chr$(0)
'Create the icon
Shell_NotifyIcon NIM_ADD, TrayI
Me.Hide
End Sub
Private Sub Form_Unload(Cancel As Integer)
'remove the icon
TrayI.cbSize = Len(TrayI)
TrayI.hWnd = pichook.hWnd
TrayI.uId = 1&
Shell_NotifyIcon NIM_DELETE, TrayI
End
End Sub
Private Sub mnuPop_Click(Index As Integer)
Select Case Index
Case 0
MsgBox "Test Message"
Case 2
Unload Me
End Select
End Sub
Private Sub pichook_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Msg = X / Screen.TwipsPerPixelX
If Msg = WM_LBUTTONDBLCLK Then
'Left button double click
mnuPop_Click 0
ElseIf Msg = WM_RBUTTONUP Then
'Right button click
Me.PopupMenu mnuPopUp
End If
End Sub
Private Sub Timer1_Timer()
Static Tek As Integer
'Animate the icon
Me.Icon = imgIcon(Tek).Picture
TrayI.hIcon = imgIcon(Tek).Picture
Tek = Tek + 1
If Tek = 3 Then Tek = 0
Shell_NotifyIcon NIM_MODIFY, TrayI
End Sub
Ah! lots of things to write in VB, Thats why I like
VB.NET all one needs is
System.Windows.Forms.NotifyIcon class.
Dim x As New System.Windows.Forms.NotifyIcon
x.Visible = True
x.Text = "Tray Icon"
x.Icon = New System.Drawing.Icon("C:\yvideo.ico")
To Associate a menu just create a contextmenu in VB.NET and assign it as below.
x.ContextMenu = MyContextMenu1
Wow! Sweet and Simple. |
|
|
|
|
|
|
|
|
|
|