Here is simple Notification Bar control (like we see in Internet Explorer). Gives application a good look. Note that I haven't done much thing, you can customize is further if you like. It supports blinking too.
Usage:
ShowNotification() method to display the Notification.
BlinkTimes property to set the Number of Times to blink.
Download Source Code:
Notificationbar.zip
Saturday, February 14, 2009
Notification Bar Control For Windows Forms (Win Forms)
Here is simple Notification Bar control (like we see in Internet Explorer). Gives application a good look. Note that I haven't done much thing, you can customize is further if you like. It supports blinking too.
Usage:
ShowNotification() method to display the Notification.
BlinkTimes property to set the Number of Times to blink.
Download Source Code:
Notificationbar.zip
Monday, January 26, 2009
DataGridView Custom Cell ToolTip
Level: Intermediate
Knowledge Required:- DataGridView Control
- Windows Forms
Friday, January 23, 2009
NOT Focusable / NOT Selectable Button
Level: Intermediate
Knowledge Required:
User Controls
Description:
Few days back I was creating a user control like ComboBox. In ComboBox we have a Drop Down button at the right side, which cannot have focus. This button can only be clicked by mouse to open the Drop Down portion (Alt+Down is the shortcut).
Similarly my control also have a button on right. I decided to make that button just like the Drop Down button of ComboBox. For this purpose I added a plain Class in my project and then put the following Code,
Knowledge Required:
User Controls
Description:
Few days back I was creating a user control like ComboBox. In ComboBox we have a Drop Down button at the right side, which cannot have focus. This button can only be clicked by mouse to open the Drop Down portion (Alt+Down is the shortcut).
Similarly my control also have a button on right. I decided to make that button just like the Drop Down button of ComboBox. For this purpose I added a plain Class in my project and then put the following Code,
Public Class NotSelectableButton
Inherits Button
Public Sub New()
MyBase.New()
' following line will make this button Not Focusable
SetStyle(ControlStyles.Selectable, False)
End Sub
End Class
Saturday, January 17, 2009
FTP File Upload Error
It seems that our Network Administrator has changed some settings because my previous file uploading code is NOT working. And giving the following exception:
The server returned an address in response to the PASV command that is different than the address to which the FTP connection was made.
I was using the VB.net My namespace,
Then I modified and created my own upload function as,
The server returned an address in response to the PASV command that is different than the address to which the FTP connection was made.
I was using the VB.net My namespace,
My.Computer.Network.UploadFile("C:\SomeFile.txt", "ftp://ftpsite/somefile.txt", "userid", "pwd")So I Googled about that error and found some dicussion on MSDN forums.Then I modified and created my own upload function as,
Private Sub UploadFile(ByVal sDestination As String, ByVal sSource As String, ByVal sUserID As String, ByVal sPassword As String)
Dim i As System.Net.FtpWebRequest
Dim us As System.IO.Stream
Dim filebytes As Byte()
' create the FTP Web Request
i = System.Net.WebRequest.Create(sDestination)
' set credentials
i.Credentials = New System.Net.NetworkCredential(sUserID, sPassword)
' method = Upload File
i.Method = System.Net.WebRequestMethods.Ftp.UploadFile
i.UsePassive = False
i.Proxy = Nothing
' get the Request Stream
us = i.GetRequestStream()
' get the file bytes from source
filebytes = My.Computer.FileSystem.ReadAllBytes(sSource)
' write the bytes in stream
us.Write(filebytes, 0, filebytes.Length)
' close the stream
us.Close()
End Sub
Warning! Above function will read all the bytes (in one go) from file. Which is NOT a good practice for larger files.
Subscribe to:
Posts (Atom)