|
Could someone offer advise on how to code my forms to allow end users to customize the layout that gets saved for each time they use the application. Example:
The user would like the label for a text box to be First Name instead of Name and the tab order should change. They may also change the font size color, etc...
The other customization would be the user could move the control around the form. lets say this business likes to see lastname as the first text box on the form but the default install it is 5 down the list.
This should all be saved and set as the default. I could use the applications database but am concerned that it would hurt performance since I have dozens on forms and controls.
Also, how do you think the performance will be effected if every form has to go thru every control to set the customized paramaters.
Thanks
|
|
|
|
|
I am working on a Windows form and would like some help to figure out how to time out the application and lock it after a period of inactivity.
|
|
|
|
|
You might want to look into using the Application.Idle event [^]. You could probably reset a Timer (not a Forms timer!) to say 5 minutes every time this event gets called, then handle the Tick event of the Timer to lock your application.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I want to display the year on a label on my form.
How do you get the year from the date.
I have tried this to no avail:
Dim DateItem As Date
Num.Text = d.Year.ToString()
Num is the label name
Anyone any ideas?
|
|
|
|
|
'this would get today's year
num.text = Date.Now.Year.ToString
so you need to set DateItem to a date before using it.
dim DateItem as new date(2005,05,23)
num.text = DateItem.Year.ToString
|
|
|
|
|
Chris,
Thanks for the reply.
Is it necessary to set the date as dim DateItem as new date(2005,05,23), could you not get the date from the system as System.Date ?
|
|
|
|
|
Here is what I've used in the past:
label1.Text = CStr(Year(CDate(DateString)))
Hope this helps
Lost in the vast sea of .NET
<a href="http://www.komputing.com/Pricelist.html">Visit my website at www.komputing.com</a>
|
|
|
|
|
No. All you need to get the current date is:
Dim myDate As Date = Date.Now()
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
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.
|
|
|
|