|
Im using visual basic, I think thats VB.net? It didnt recognize some of the commands on that source code.
thnx, mike
|
|
|
|
|
'read
Dim l_string As String
Dim i As Integer
FileOpen(1, "doc.txt", OpenMode.Input)
For i = 1 To 3
Input(1, l_string)
Next i
'you will only need to do the input once so the for loop could be left out
'write the file
FileOpen(1, "doc.txt", OpenMode.Output)
Write(1, "# of times opened")
FileClose(1)
this should work, it's been a long time since i did vb6 programming. (this is vb6 btw)
I got the "memory jolt" from here[^]
Brian Van Beek
My Blog is Awesome, ok maybe not, but is still fun!!
|
|
|
|
|
I'm getting recognition problems again, its expecting "=" after FileOpen, and expecting "#" after input.
thnx, mike
|
|
|
|
|
I have a form where the startposition is set to center. Once the client moves it around on the screen I want to get the position of the screen, save it to isolated storage and then retrieve the setting the next time the program starts and position the screen where the client left it last.
I have isolated storage code working fine in the program. I just need to figure out how to get the position and then later set the position.
Has anyone tried this, and if so do you have sample code or suggestions?
Thanks
Lost in the vast sea of .NET
<a href="http://www.komputing.com/Pricelist.html">Visit my website at www.komputing.com</a>
|
|
|
|
|
Hi KreativeKai;
To get the location of the form after moving it do something like this in the form move event
Private isolatedStorageFormPosition As Point
Private Sub Form1_Move(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Move
isolatedStorageFormPosition = Me.Location
End Sub
On the Form load event this.
Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Me.Location = isolatedStorageFormPosition
End Sub
Fernando
|
|
|
|
|
I used your suggestions and it works great!! Thanks!
Lost in the vast sea of .NET
<a href="http://www.komputing.com/Pricelist.html">Visit my website at www.komputing.com</a>
|
|
|
|
|
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]
|
|
|
|