You can keep all of these in the settings configuration file. Double click the "My Project" icon in your solution explorer. There should be a tab called "Settings", click that. In there you can add all of the user settings you like, such as, last entry, form colors, etc....
Then, when you need to get the data from these, simply type My.Settings.LastEntry to get the value.
Tall Dude, Thank you soooo much for the help. My program is almost done now thanks to you.
I do have two more question for you.
Q1: I have one option in my program that allows users to check the status on their last entry. What would be the easiest and most effective way to store that information
Would u just go of off the last entry posted to the db or would u write it to a small file somewhere
Q2: Also, how would you allow users to change some preferences on the program and save it so that it will look at those prefs each time it launches
===================
The most important part of this is the first question and I can address the second question with and update at a later point in time.
When something is saved in the "MyFont" (for example), if it is changed will it overwrite anything that is written in that field already
==========================
To give you an idea of what I am doing: I'm writing a small software piece to track any errors that any of my employee's might encounter, during a normal day, so that I can keep a running total of everything.
My prog captures Username, Time, Date, CompName and allows users to input Program, Description, and Screenshot of error message.
The program, after the Submit button is clicked, writes the information to a local database and informs myself or my fellow co-worker that a new ticket is open.
This software will track all notes that the "Techs" enter, if they do, and the time it took to correct the error. Also will track how long the ticket was open for.
How to make a program run in the taskbar?????
Nick1435
ShadowRayz
My.Settings.myfont = TextBox1.Font
Takes the current textbox1.font, no matter
how many times it was changed during running
the program, and saves it to the 'one entry only'
My.Settings.myfont storage location, replacing
whatever the previous value was.
Most all settings available in the designer
only hold one value. (With the exception of
the System.Collections.Specialized.StringCollection.)
Normally settings are automatically loaded when a program starts,
and automatically saved once as the program exits.
You can manually control this however using
My.Application.SaveMySettingsOnExit = False
My
.Settings.Reload()My.Settings.Save()
You have to explicitly assign the setting value to something for it to be used:
TextBox1.Font = My.Settings.myfont
and you have to explicitly assign the setting a new value if you want a new value
when settings are saved:
My
.Settings.myfont = TextBox1.Fontvicky_dceian
You can keep all of these in the settings configuration file. Double click the "My Project" icon in your solution explorer. There should be a tab called "Settings", click that. In there you can add all of the user settings you like, such as, last entry, form colors, etc....
Then, when you need to get the data from these, simply type My.Settings.LastEntry to get the value.
Chris Spain
Tall Dude, Thank you soooo much for the help. My program is almost done now thanks to you.
I do have two more question for you.
Q1:
I have one option in my program that allows users to check the status on their last entry. What would be the easiest and most effective way to store that information
Would u just go of off the last entry posted to the db or would u write it to a small file somewhere
Q2:
Also, how would you allow users to change some preferences on the program and save it so that it will look at those prefs each time it launches
===================
The most important part of this is the first question and I can address the second question with and update at a later point in time.
kats
When something is saved in the "MyFont" (for example), if it is changed will it overwrite anything that is written in that field already
==========================
To give you an idea of what I am doing: I'm writing a small software piece to track any errors that any of my employee's might encounter, during a normal day, so that I can keep a running total of everything.
My prog captures Username, Time, Date, CompName and allows users to input Program, Description, and Screenshot of error message.
The program, after the Submit button is clicked, writes the information to a local database and informs myself or my fellow co-worker that a new ticket is open.
This software will track all notes that the "Techs" enter, if they do, and the time it took to correct the error. Also will track how long the ticket was open for.
NewASPNETUser
Okay, now that you have helped me figure that out. Here are a couple more questions regarding that item.
1. I have the icon showing in the system tray now. I want to be able to single MouseClick on it and a menu show up. Can this happen
2. If I double click the icon in the system tray I want it to open the main menu back up.
3. If the user clicks on the minimize, can the program "hide" or minimize to the system tray
Thanks for all of your help.
wuzzle
Do you mean the notification area (ie by the clock, sometimes called the task tray or system tray)
In order to show some peice of your application there, you need only use the NotifyIcon class. You can find a quick example of how to do that here.
nikos_22
Add a ContextMenuStrip1.
Add some menu items to the ContextMenuStrip1.
Set the NotifyIcon's ContextMenuStrip to ContextMenuStrip1.
Then:
Public Class Form1
Private Sub NotifyIcon1_MouseDoubleClick(ByVal sender As System.Object, _
ByVal e As System.Windows.Forms.MouseEventArgs) Handles NotifyIcon1.MouseDoubleClick
Me.Visible = True
Me.WindowState = FormWindowState.Maximized ' or normal
End Sub
Private Sub Form1_SizeChanged(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles Me.SizeChanged
If Me.WindowState = FormWindowState.Minimized Then
Me.Visible = False
End If
End Sub
End Class
xavito
dickP
In the settings tab:
Name: Myfont
Type: System.Drawing.Font
Scope: User
Value: Microsoft Sans Serif, 12pt, style=Bold (Or double click the
white area in value for a dialog)
Name: MyColor
Type: System.Drawing.Color
Scope: User
Value: Tomato (Or double click the
white area in value for a dialog)
Then some code:
Public Class Form1
Private Sub Form1_FormClosing(ByVal sender As Object, _
ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
My.Settings.myfont = TextBox1.Font
My.Settings.mycolor = TextBox1.ForeColor
My.Settings.Save()
End Sub
Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles Me.Load
TextBox1.Font = My.Settings.myfont
TextBox1.ForeColor = My.Settings.mycolor
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
MsgBox("Choose a new font and color for the textbox")
If FontDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
TextBox1.Font = FontDialog1.Font
End If
If ColorDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
TextBox1.ForeColor = ColorDialog1.Color
End If
End Sub
End Class