Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

C# Textbox control default values from System.Environment

$
0
0

Hello

I've worked in MS Access since version 2.0, but am new to C#.

I want to set the default value of a textbox control (txt_User) to System.Environment.GetEnvironmentVariable("UserName");       

Currently I am doing it with script in the Load event. Script follows:

private void Switchboard_Frm_Load(object sender, EventArgs e)        {            this.txt_User.Text = System.Environment.GetEnvironmentVariable("UserName");        }

However - I want to know if default values, from System.Environment, can be set at the control itself. In access I could set the control source property of a given textbox to pick up the logged in user. Is there anyway to do this in a property setting of a C# textbox?

I'm working in Visual C# 2010 Express - doing some testing before advocating a move from Access to Visual C# for some of my client's databases.

Thanks in advance - Pavilion


Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>