|
Thanks for the reply.
I realise this should bring back the date Now but how do I get the year from this date Now as it is bringing back the entire date?
|
|
|
|
|
Dim myDate As Date = Date.Now()
Dim myYear As String = myDate.Year()
|
|
|
|
|
Thanks for the reply.
That Anonymous posting was me also, I hadn't logged in, i logged in and reposted so you know who is posting.
I realise the above code should bring back the date Now but how do I get the year from this date Now as it is bringing back the entire date?
|
|
|
|
|
The Year property is an Integer, so it work just like any other Interger number.
Dim myDate As Date = Date.Now
Dim currentYear As Integer = myDate.Year
or, in a single line of code:
Dim currentYear As Integer = Date.Now.Year
Docs for the DateTime structure[^]
Now is a static property that always returns the current Date and Time in a single DateTime structure. You could use the Today static property to return just the date, but it still returns an entire DateTime structure, just with the time set to 00:00:00.0.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Are you still having trouble getting the year from the date?
Have you tried the following (this will get the current year):
num.text = Date.Now.Year.ToString
For example, today is May 23, 2005
Date.Now.Year.ToString --> will print 2005
Date.Now.Month.ToString --> will print 5
Date.Now.Day.ToString --> will print 23
If you want some other year (let's say you're parsing a date string)
dim DateItem as Date = Date.Parse(dateString)
num.text = DateItem.Year.ToString
or
num.text = Date.Parse(dateString).Year.ToString
Hope this helps,
Chris
|
|
|
|
|
Try this.
Label1.Caption = Year(Date)
George
|
|
|
|
|
Hello There
Can any one give me a reference for any tutorial or help on using OwnerDraw.. I have to build couple of custom controls and need to understand the basics and usage of Owner Draw...
like List View Control with Headers having color say blue...
like back color for Menu... I found couple of custom Menu Controls but need to understand it properly which I could not.
like Scrollbar color and Style for Panel Control etc...
thanks for support
|
|
|
|
|
Hi,
I have 2 TextBoxes on my windows form free from panels..
I want to jump from first textBox to second when i hit a special character in my keyboard( like comma).
I want to write this to 2 textBoxes( 123.456,789)
(123.456) to first textBox and (789) to second textBox without hit to TAB, just by comma .
Thanx in advance..
-MCP& MCAD &junior coder--
|
|
|
|
|
Use the Keypress event of your first textbox to get the key that the user is typing. Set keypressEventArgument.Handled to true if key typed is a comma and then set focus to next textbox.
|
|
|
|
|
Here is my code that u talk about:
----------------------------------
1- Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As
2-System.Windows.Forms.KeyPressEventArgs)Handles TextBox1.KeyPress
3- If Not InStr("0123456789," + Chr(8) , e.KeyChar) > 0 Then
4- e.Handled = True
5- End If
6- If e.KeyChar = "," Then
7- e.Handled = True
8-?????? 'I dont know how to focus cursor to 'TexBox2.SelecetionStart=0
10- End If
11- End Sub
Plz, would someone give me the code of line 8 at upperside..
Thanx in advance..
-MCP& MCAD &junior coder--
|
|
|
|
|
textbox2.Select(0, 0) 'To locate cursor at the begining
textbox2.SelectAll() 'To Select all the content of the textbox
textbox2.Focus()
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Try this.
Private Sub Text1_Change()
Dim lCount As Long
lCount = Len(Text1.Text)
For lCount = 1 To lCount
If Mid$(Text1.Text, lCount, 1) = "," Then
Text1.Text = Left$(Text1, (lCount - 1))
Text2.SetFocus
Exit For
End If
Next lCount
End Sub
George
|
|
|
|
|
if me.TextBox1.Tex="." Then
me.TextBox2.Focus()
End If
I hope this helps to you
|
|
|
|
|
hi,
We are doing a project on Live video conferencing in LAN.File is recoreded on a single PC but the actual thing must do is to send the data on a network.I m using directshow for this in which "IMediaControl Interface" is used for run and stop the file to record.But i need the actual data(streams).The question is:
1.How to get Audio & Video Stream data using Directshow?
2.How to send,replay this data on network?
plz reply me soon.
best regards
shumyla
|
|
|
|
|
i want to enable a textbox by clicking on a radiobutton. i mean that when i check a radiobutton1 then a textbox called textbox1 should get enabled how do i do that.
|
|
|
|
|
myTextBx.Enabled = true
where myTextBx is your textbox control
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
well this is my code: -
Private Sub Radiobutton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Radiobutton1.CheckedChanged
If Radiobutton1.Checked = True Then
TextBox6.Enabled = True
Else
TextBox6.Enabled = False
End If
End Sub
but it is not working. no errors but not working.
|
|
|
|
|
well this is my code: -
Private Sub Radiobutton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Radiobutton1.CheckedChanged
If Radiobutton1.Checked = True Then
TextBox6.Enabled = True
Else
TextBox6.Enabled = False
End If
End Sub
but it is not working. no errors but not working.
|
|
|
|
|
set a breakpoint into the function and watch if the function is called...
and watch also if it is going into the right case (maybe Radiobutton1.Checked is not set to what you think...)
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
i'm still not able to figure out what exactly is the fault. or where things are goin wrong. is there any other way to make a textbox active other than using radiobuttons and buttons.
|
|
|
|
|
hum, no, there no other way.
but i thought to something : isn't your textbox into a groupbox that is itself disabled (Enabled = false) ??
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
no it's directly on the webform.
|
|
|
|
|
try this.
Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton14.CheckedChanged
Dim rdoTemp As RadioButton = CType(sender, RadioButton)
TextBox1.Enabled = rdoTemp.Checked
End Sub
|
|
|
|
|
|
What exactly are you trying to achieve - all the code submitted in this thread works, so I suspect that you may be doing something out of the ordinary. Is a radio button the right control for you remembering that they are grouped.
Perhaps a little more explanation of the task at hand may help in providing a solution that works for you.
|
|
|
|