Tag Archives: C#

How to implement Window Authentication Functionality to a C# Desktop Application

1)  Get currently logged in user details: We can achieve this by using the WindowsIdentity class of System.Security.Principal namespace. This class provides a static method, getCurrent(), which return a object of WindowsIdentity. 2) Validate windows credentials provided by user:(Ask User … Continue reading

Posted in General | Tagged , , | 4 Comments

Writing to an ms access database using C# Window Application

Please try below code to write in MS ACCESS databse using C# Window Application: System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection(@”Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\amar\Documents\Database1.accdb”); conn.Open(); using (System.Data.OleDb.OleDbCommand cmd = new System.Data.OleDb.OleDbCommand()) { cmd.Connection = conn; cmd.CommandText = “Insert Into Employee (UserName, fname, sname, email) … Continue reading

Posted in General | Tagged , , | 3 Comments

How to get date value form one form to another form using C# in Window Application

Create a constructor on form2 with input parameter as date time. And when you create object of form2 in form1 just pass the date value using C# in window application. form1 coding: DateTime objdate = dateTimePicker1.Value; form2 objform2= new form2(objdate) … Continue reading

Posted in General | Tagged , | Leave a comment

How to create a thread by using C# to show Progress Bar in Window Application

1. Start Microsoft Visual Studio .NET. 2. Create a new Visual C# Windows Application project named ThreadWinApp. 3. Add a Button control to the form. By default, the button is named Button1. 4. Add a ProgressBar component to the form. … Continue reading

Posted in General | Tagged , , , | 1 Comment

How to pass parameters and get return values for Multithreaded Procedures using C#

Supplying and returning values in a multithreaded application is complicated because the constructor for the thread class must be passed a reference to a procedure that takes no arguments and returns no value. Parameters for Multithreaded Procedure The best way … Continue reading

Posted in General | Tagged , | Leave a comment