Click here to Skip to main content
15,887,027 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: How retain scrollbar positions of Datagridview? Pin
Dave Kreskowiak14-Apr-08 5:43
mveDave Kreskowiak14-Apr-08 5:43 
GeneralDate format problem Pin
AHeavey14-Apr-08 2:03
AHeavey14-Apr-08 2:03 
GeneralRe: Date format problem Pin
Rajesh Anuhya14-Apr-08 2:06
professionalRajesh Anuhya14-Apr-08 2:06 
GeneralRe: Date format problem Pin
Luc Pattyn14-Apr-08 2:08
sitebuilderLuc Pattyn14-Apr-08 2:08 
GeneralRe: Date format problem Pin
Rajesh Anuhya14-Apr-08 2:19
professionalRajesh Anuhya14-Apr-08 2:19 
GeneralRe: Date format problem Pin
Guffa14-Apr-08 3:08
Guffa14-Apr-08 3:08 
GeneralRe: Date format problem Pin
AHeavey14-Apr-08 3:36
AHeavey14-Apr-08 3:36 
GeneralRe: Date format problem Pin
helelark12314-Apr-08 4:01
helelark12314-Apr-08 4:01 
You can use the following function:
#Region "Function GetDate - returns date / time according to format"
Public Function GetDate(ByVal MyFormat As String, Optional ByVal dt As Date = Nothing) As String
Try
If dt = Nothing Then
Return Now.ToString(MyFormat, DateTimeFormatInfo.InvariantInfo)
Else
Return dt.ToString(MyFormat, DateTimeFormatInfo.InvariantInfo)
End If
Catch ex As Exception
MessageBox.Show(ex.Message, "GetDate", MessageBoxButtons.OK, MessageBoxIcon.Error)

End Try
Return ""
' MyFormat can be
' * d :08/17/2000
' * D :Thursday, August 17, 2000
' * f :Thursday, August 17, 2000 16:32
' * F :Thursday, August 17, 2000 16:32:32
' * g :08/17/2000 16:32
' * G :08/17/2000 16:32:32
' * m :August 17
' * r :Thu, 17 Aug 2000 23:32:32 GMT
' * s :2000-08-17T16:32:32
' * t :16:32
' * T :16:32:32
' * u :2000-08-17 23:32:32Z
' * U :Thursday, August 17, 2000 23:32:32
' * y :August, 2000
' * dddd, MMMM dd yyyy :Thursday, August 17 2000
' * ddd, MMM d "'"yy :Thu, Aug 17 '00
' * dddd, MMMM dd :Thursday, August 17
' * M/yy :8/00
' * dd-MM-yy :17-08-00
' *dd/MM/yyyy : 17/08/2000
End Function
#End Region

Comment:
You can improve and add another overloaded function that will get as parameter an enum parameter (containing the different formats)

Shay Noy

GeneralRe: Date format problem Pin
AHeavey14-Apr-08 5:05
AHeavey14-Apr-08 5:05 
GeneralRe: Date format problem Pin
Luc Pattyn14-Apr-08 5:17
sitebuilderLuc Pattyn14-Apr-08 5:17 
GeneralRe: Date format problem Pin
Luc Pattyn14-Apr-08 5:23
sitebuilderLuc Pattyn14-Apr-08 5:23 
GeneralRe: Date format problem Pin
AHeavey14-Apr-08 6:46
AHeavey14-Apr-08 6:46 
Generalconnection error Pin
Member 426231713-Apr-08 22:36
Member 426231713-Apr-08 22:36 
GeneralRe: connection error Pin
N a v a n e e t h13-Apr-08 23:00
N a v a n e e t h13-Apr-08 23:00 
GeneralRe: connection error Pin
Christian Graus13-Apr-08 23:41
protectorChristian Graus13-Apr-08 23:41 
GeneralRe: connection error Pin
Anoop Brijmohun13-Apr-08 23:42
Anoop Brijmohun13-Apr-08 23:42 
GeneralRe: connection error Pin
Christian Graus13-Apr-08 23:55
protectorChristian Graus13-Apr-08 23:55 
GeneralRe: connection error Pin
ChandraRam14-Apr-08 1:11
ChandraRam14-Apr-08 1:11 
GeneralRe: connection error Pin
Member 426231714-Apr-08 2:08
Member 426231714-Apr-08 2:08 
GeneralRe: connection error Pin
Smithers-Jones14-Apr-08 2:42
Smithers-Jones14-Apr-08 2:42 
GeneralRe: connection error Pin
Christian Graus14-Apr-08 3:05
protectorChristian Graus14-Apr-08 3:05 
GeneralRe: connection error Pin
ChandraRam14-Apr-08 4:40
ChandraRam14-Apr-08 4:40 
QuestionHow to send Multiple values for one formula field in crystal reports through vb.net? Pin
aswath00713-Apr-08 22:00
aswath00713-Apr-08 22:00 
GeneralRe: How to send Multiple values for one formula field in crystal reports through vb.net? Pin
aswath00714-Apr-08 2:26
aswath00714-Apr-08 2:26 
Generalmp3 recording / LAME encoder Pin
Fred Worms13-Apr-08 21:26
Fred Worms13-Apr-08 21:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.