C# Disable Datagridview Sorting,How to disable datagridview sorting c#, Enable and Disable Datagridview Sorting.
Steps:-
To Disable Datagridview Sorting Add Columns then take Edit Column set sortmode property to notsortable
Friday, January 15, 2010
Sunday, December 20, 2009
Frequently asked ASP.Net Interview Questions List ASP.Net Interview Questions
Frequently asked ASP.Net Interview Questions List ASP.Net Interview Questions
1. Explain the differences between Server-side and Client-side code?
2. What type of code (server or client) is found in a Code-Behind
class?
3. Should validation (did the user enter a real date) occur
server-side or client-side? Why?
4. What does the "EnableViewState" property do? Why would I want it on or off?
5. What is the difference between Server.Transfer and
Posted by
Praveen P.R
Friday, December 18, 2009
Earn money with PayPal through the referral bonus program Get PayPal Account PayPal Referral Bonus
Earn money with PayPal through the referral bonus program Get PayPal Account PayPal Referral Bonus
https://www.paypal.com/
First login to your PayPal account, then click on "Referrals" at the footer of the site, as you can see in the following image:
Within the page will find the referral link and the official PayPal banner and HTML code.
Paste this HTML code to your site or blog ..
https://www.paypal.com/
First login to your PayPal account, then click on "Referrals" at the footer of the site, as you can see in the following image:
Within the page will find the referral link and the official PayPal banner and HTML code.
Paste this HTML code to your site or blog ..
Posted by
Praveen P.R
Thursday, December 17, 2009
Interview Questions: C# ASP.NET DataGrid Questions Interview What is datagrid Hide the columns Customize the Column Formatting to the data inside the cells Reference MSDN
ASP.NET DataGrid Questions Interview Questions: C# |
1. What is datagrid? The DataGrid Web server control is a powerful tool for displaying information from a data source. It is easy to use; you can display editable data in a professional-looking grid by setting only a few properties. At the same time, the grid has a sophisticated object model that provides you with great flexibility in how you display the data.
Posted by
Praveen P.R
Monday, November 23, 2009
Write DataGridview data to XML Praveen PR
C#
DataTable dt=(DataTable)DataGridview.datasourc;
DataTable dt=(DataTable)DataGridview.datasourc;
Posted by
Praveen P.R
Monday, November 16, 2009
IsNumeric function in C# equivalent to VB6 IsNumeric() By Praveen P R
// C# .NET
//Check Value if numeric
public static bool IsNumeric(object Expression)
{
bool isNum;
double retNum;
isNum = Double.TryParse(Convert.ToString(Expression), System.Globalization.NumberStyles.Any, System.Globalization.NumberFormatInfo.InvariantInfo, out retNum);
return isNum;
}
http://prpraveen.blogspot.com/
//Check Value if numeric
public static bool IsNumeric(object Expression)
{
bool isNum;
double retNum;
isNum = Double.TryParse(Convert.ToString(Expression), System.Globalization.NumberStyles.Any, System.Globalization.NumberFormatInfo.InvariantInfo, out retNum);
return isNum;
}
http://prpraveen.blogspot.com/
Posted by
Praveen P.R
Thursday, November 12, 2009
Focus to next Control in winform on Enter Key Press C# By Praveen PR
Step 1.
//Add the funtion in any common class (static class) so the you can access if from any form you added
//Send Focus to next Control in Form
public static void sendTab(Keys sendKey, object sender)
{
if (sendKey == Keys.Enter)
{
SendKeys.Send("{TAB}");
}
else if (sendKey == Keys.Right)
{
//if (sender.GetType().Name != "DateTimePicker")
//{
// SendKeys.Send("{TAB}");
//}
//Add the funtion in any common class (static class) so the you can access if from any form you added
//Send Focus to next Control in Form
public static void sendTab(Keys sendKey, object sender)
{
if (sendKey == Keys.Enter)
{
SendKeys.Send("{TAB}");
}
else if (sendKey == Keys.Right)
{
//if (sender.GetType().Name != "DateTimePicker")
//{
// SendKeys.Send("{TAB}");
//}
Posted by
Praveen P.R
Saturday, October 24, 2009
System.Data.SqlClient.SqlException: Directory lookup for the file...failed with the operating system error 5(Access is denied.)
//E.g SqlExpress
1.Click the Windows Start button, and then click Run. The Run dialog box appears.
2.Type Services.msc into the Open field, and then click OK. The Services
panel appears:
3.Right-click the SQL Server (SqlEx[ress) service, and then click Properties from the shortcut menu. The SQL Server (SqlExpress) Properties (Local Computer) dialog box appears:
4.On the Log On tab, select Local System account for the Log on as option.
5.Press Apply and then press OK on the dialog box that appears.
6.Click on the General tab and then press Stop the stop the service, and Start to restart the SqlExpress service.
7.Press OK and close the services Console.
8.Launch SqlExpress and attempt to now restore the database.
http://www.prpraveen.blogspot.com
1.Click the Windows Start button, and then click Run. The Run dialog box appears.
2.Type Services.msc into the Open field, and then click OK. The Services
panel appears:
3.Right-click the SQL Server (SqlEx[ress) service, and then click Properties from the shortcut menu. The SQL Server (SqlExpress) Properties (Local Computer) dialog box appears:
4.On the Log On tab, select Local System account for the Log on as option.
5.Press Apply and then press OK on the dialog box that appears.
6.Click on the General tab and then press Stop the stop the service, and Start to restart the SqlExpress service.
7.Press OK and close the services Console.
8.Launch SqlExpress and attempt to now restore the database.
http://www.prpraveen.blogspot.com
Posted by
Praveen P.R
Monday, October 19, 2009
Problem while Saving modified .bmp file A generic error occurred in GDI+. C# .net By Praveen P.R
//Problem while Saving modified .bmp file
//A generic error occurred in GDI+.
//Do the following
//some function...... inside it.....
try
{
System.GC.Collect();//imp
System.GC.WaitForPendingFinalizers();//imp
if (System.IO.File.Exists(Application.StartupPath + @"\Alpha100.bmp"))
{
System.IO.File.Delete(Application.StartupPath + @"\Alpha100.bmp");
}
myBitmap.Save(Application.StartupPath + @"\Alpha100.bmp");
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
//A generic error occurred in GDI+.
//Do the following
//some function...... inside it.....
try
{
System.GC.Collect();//imp
System.GC.WaitForPendingFinalizers();//imp
if (System.IO.File.Exists(Application.StartupPath + @"\Alpha100.bmp"))
{
System.IO.File.Delete(Application.StartupPath + @"\Alpha100.bmp");
}
myBitmap.Save(Application.StartupPath + @"\Alpha100.bmp");
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
Posted by
Praveen P.R
Steps to Create a Crystal Report based on an XML schema (XSD) file.
1.Create Dataset with.(e.g Select * from anytable)
Note:-Basic knowledge of C# required
2.e.g Dataset ds;
3.Then write the following code e.g ds.WriteXmlSchema("RptDailyAll.xsd");
4.Above code will genrate "RptDailyAll.xsd" file in the current directory
5.Now open a new crystall report and follow the steps as seen in images
Note:-Basic knowledge of C# required
2.e.g Dataset ds;
3.Then write the following code e.g ds.WriteXmlSchema("RptDailyAll.xsd");
4.Above code will genrate "RptDailyAll.xsd" file in the current directory
5.Now open a new crystall report and follow the steps as seen in images
Posted by
Praveen P.R
Tuesday, October 13, 2009
Steps VSS Visual Source Safe .net By Praveen P.R
Step to Manage VSS
1.Create folder for VSS this will act as Server Database.
2.Make this folder shared .So to access for client System.
2.Now take-->Microsoft Visual SourceSafe Administration(Programs->Microsoft Visual SourceSafe-->)
3 Create new database
Menu File-->New DataBase...
1.Create folder for VSS this will act as Server Database.
2.Make this folder shared .So to access for client System.
2.Now take-->Microsoft Visual SourceSafe Administration(Programs->Microsoft Visual SourceSafe-->)
3 Create new database
Menu File-->New DataBase...
Posted by
Praveen P.R
Monday, October 12, 2009
Install .bak file at first run / installation C# By Praveen P.R
//This is to show how to restore your .bak file (SQL Express) when your first run the application
1. Add this code in your app.config file
add key="ConnectionString" value="Data Source=.\sqlexpress;Initial Catalog=Transactions;Integrated Security=True"
add key="ConnectionStringM" value="Data Source=.\sqlexpress;Initial Catalog=master;Integrated Security=True"
using connectionstring added above
using System.Configuration; this.connectionString = ConfigurationSettings.AppSettings["ConnectionString"];
2. Above code is to connect to sql express default database
3.Now when your application runs for the first time check the name of the database if it exists in sql express
with the above connection string.
4.for eg.
CheckDBExist("Transactions");//database name
5.
private bool CheckDBExist(string dbName)
{
BLLTransaction bllTransaction = new BLLTransaction(classGlobal.connectionStringM);
DataSet dsChkDBExist;
dsChkDBExist = bllTransaction.Select("select * from sys.databases where name = '" + dbName + "'");
if (dsChkDBExist.Tables[0].Rows.Count == 0)
{
DialogResult result = MessageBox.Show("Database not found.\nDo you want to Restore Database?", "Restore Database", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result == DialogResult.Yes)
{
try
{
Server mServer = new Server(@".\sqlexpress");
//mServer.KillAllProcesses("Transactions");
//mServer.DetachDatabase("Transactions", true);
//Application.StartupPath.Replace only needed at project devlopment
File.Move(Application.StartupPath.Replace("bin\\Debug", "") + @"TranDB\Transactions.mdf", @"C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\data\Transactions.mdf");
File.Move(Application.StartupPath.Replace("bin\\Debug", "") + @"TranDB\Transactions_log.ldf", @"C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\data\Transactions_log.ldf");
//File.Move(Application.StartupPath + @"TranDB\Transactions.mdf", @"C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\data\Transactions.mdf");
//File.Move(Application.StartupPath + @"TranDB\Transactions_log.ldf", @"C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\data\Transactions_log.ldf");
StringCollection files = new StringCollection();
files.Add(@"C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\data\Transactions.mdf");
files.Add(@"C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\data\Transactions_log.ldf");
mServer.AttachDatabase("Transactions", files, AttachOptions.None);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
}
return true;
}
6.The above code have my bll class which i use for connection above code to give some idea ;)
7.getSqlExpressPath() //to get sqlexpress path
private string getSqlExpressPath()
{
string path = "";
using (RegistryKey sqlServerKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Microsoft SQL Server"))
{
foreach (string subKeyName in sqlServerKey.GetSubKeyNames())
{
if (subKeyName.StartsWith("MSSQL."))
{
using (RegistryKey instanceKey = sqlServerKey.OpenSubKey(subKeyName))
{
string instanceName = instanceKey.GetValue("").ToString();
if (instanceName == "SQLEXPRESS")//say
{
path = instanceKey.OpenSubKey(@"Setup").GetValue("SQLBinRoot").ToString();
path = Path.Combine(path, "sqlserver.exe");
}
}
}
}
}
return path;
}
http://www.prpraveen.blogspot.com
1. Add this code in your app.config file
3.Now when your application runs for the first time check the name of the database if it exists in sql express
with the above connection string.
4.for eg.
CheckDBExist("Transactions");//database name
5.
private bool CheckDBExist(string dbName)
{
BLLTransaction bllTransaction = new BLLTransaction(classGlobal.connectionStringM);
DataSet dsChkDBExist;
dsChkDBExist = bllTransaction.Select("select * from sys.databases where name = '" + dbName + "'");
if (dsChkDBExist.Tables[0].Rows.Count == 0)
{
DialogResult result = MessageBox.Show("Database not found.\nDo you want to Restore Database?", "Restore Database", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result == DialogResult.Yes)
{
try
{
Server mServer = new Server(@".\sqlexpress");
//mServer.KillAllProcesses("Transactions");
//mServer.DetachDatabase("Transactions", true);
//Application.StartupPath.Replace only needed at project devlopment
File.Move(Application.StartupPath.Replace("bin\\Debug", "") + @"TranDB\Transactions.mdf", @"C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\data\Transactions.mdf");
File.Move(Application.StartupPath.Replace("bin\\Debug", "") + @"TranDB\Transactions_log.ldf", @"C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\data\Transactions_log.ldf");
//File.Move(Application.StartupPath + @"TranDB\Transactions.mdf", @"C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\data\Transactions.mdf");
//File.Move(Application.StartupPath + @"TranDB\Transactions_log.ldf", @"C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\data\Transactions_log.ldf");
StringCollection files = new StringCollection();
files.Add(@"C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\data\Transactions.mdf");
files.Add(@"C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\data\Transactions_log.ldf");
mServer.AttachDatabase("Transactions", files, AttachOptions.None);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
}
return true;
}
6.The above code have my bll class which i use for connection above code to give some idea ;)
7.getSqlExpressPath() //to get sqlexpress path
{
string path = "";
using (RegistryKey sqlServerKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Microsoft SQL Server"))
{
foreach (string subKeyName in sqlServerKey.GetSubKeyNames())
{
if (subKeyName.StartsWith("MSSQL."))
{
using (RegistryKey instanceKey = sqlServerKey.OpenSubKey(subKeyName))
{
string instanceName = instanceKey.GetValue("").ToString();
if (instanceName == "SQLEXPRESS")//say
{
path = instanceKey.OpenSubKey(@"Setup").GetValue("SQLBinRoot").ToString();
path = Path.Combine(path, "sqlserver.exe");
}
}
}
}
}
return path;
}
http://www.prpraveen.blogspot.com
Posted by
Praveen P.R
Thursday, October 8, 2009
Backup DataBase as .bak sql express 2005 C# .Net By Praveen P.R
using Microsoft.SqlServer.Management;
using Microsoft.SqlServer.Management.Smo;
using Microsoft.SqlServer.Management.Common;
using System.Windows.Forms;
public void BackupDatabase(String databaseName, String userName, String password, String serverName, String destinationPath)
{
try
{
Backup sqlBackup = new Backup();
sqlBackup.Action = BackupActionType.Database;
sqlBackup.BackupSetDescription = "ArchiveDataBase:" + DateTime.Now.ToShortDateString();
sqlBackup.BackupSetName = "Archive";
sqlBackup.Database = databaseName;
BackupDeviceItem deviceItem = new BackupDeviceItem(destinationPath, DeviceType.File);
//Backup bu = new Backup();
//bu.Database = databaseName;
//bu.Devices.Add(deviceItem);
//bu.Initialize = true;
//bu.PercentCompleteNotification = 10;
//// add percent complete and complete event handlers
//bu.PercentComplete += new PercentCompleteEventHandler(Backup_PercentComplete);
//bu.Complete += new ServerMessageEventHandler(Backup_Complete);
//ServerConnection connection = new ServerConnection(serverName,userName,password);
ServerConnection connection = new ServerConnection(serverName);
Server sqlServer = new Server(connection);
Database db = sqlServer.Databases[databaseName];
sqlBackup.Initialize = true;
sqlBackup.Checksum = true;
sqlBackup.ContinueAfterError = true;
sqlBackup.Devices.Add(deviceItem);
sqlBackup.Incremental = false;
sqlBackup.ExpirationDate = DateTime.Now.AddDays(3);
sqlBackup.LogTruncation = BackupTruncateLogType.Truncate;
sqlBackup.FormatMedia = false;
sqlBackup.SqlBackup(sqlServer);
MessageBox.Show("Database Backup success....\nBackup file in " + destinationPath + ".", "Backup success", MessageBoxButtons.OK, MessageBoxIcon.None);
}
catch(Exception ex)
{
MessageBox.Show("Database Backup failed....", "Backup failed\n"+ex.InnerException.ToString () +"", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
http://www.prpraveen.blogspot.com
using Microsoft.SqlServer.Management.Smo;
using Microsoft.SqlServer.Management.Common;
using System.Windows.Forms;
public void BackupDatabase(String databaseName, String userName, String password, String serverName, String destinationPath)
{
try
{
Backup sqlBackup = new Backup();
sqlBackup.Action = BackupActionType.Database;
sqlBackup.BackupSetDescription = "ArchiveDataBase:" + DateTime.Now.ToShortDateString();
sqlBackup.BackupSetName = "Archive";
sqlBackup.Database = databaseName;
BackupDeviceItem deviceItem = new BackupDeviceItem(destinationPath, DeviceType.File);
//Backup bu = new Backup();
//bu.Database = databaseName;
//bu.Devices.Add(deviceItem);
//bu.Initialize = true;
//bu.PercentCompleteNotification = 10;
//// add percent complete and complete event handlers
//bu.PercentComplete += new PercentCompleteEventHandler(Backup_PercentComplete);
//bu.Complete += new ServerMessageEventHandler(Backup_Complete);
//ServerConnection connection = new ServerConnection(serverName,userName,password);
ServerConnection connection = new ServerConnection(serverName);
Server sqlServer = new Server(connection);
Database db = sqlServer.Databases[databaseName];
sqlBackup.Initialize = true;
sqlBackup.Checksum = true;
sqlBackup.ContinueAfterError = true;
sqlBackup.Devices.Add(deviceItem);
sqlBackup.Incremental = false;
sqlBackup.ExpirationDate = DateTime.Now.AddDays(3);
sqlBackup.LogTruncation = BackupTruncateLogType.Truncate;
sqlBackup.FormatMedia = false;
sqlBackup.SqlBackup(sqlServer);
MessageBox.Show("Database Backup success....\nBackup file in " + destinationPath + ".", "Backup success", MessageBoxButtons.OK, MessageBoxIcon.None);
}
catch(Exception ex)
{
MessageBox.Show("Database Backup failed....", "Backup failed\n"+ex.InnerException.ToString () +"", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
http://www.prpraveen.blogspot.com
Posted by
Praveen P.R
Wednesday, October 7, 2009
Restore .bak file sql express 2005 C# .Net By Praveen P.R
using Microsoft.SqlServer.Management.Smo;
using Microsoft.SqlServer.Management.Common;
using System.Windows.Forms;
public void RestoreDatabase(string databaseName,string backupFileName,String serverName)
{
try
{
ServerConnection connection = new ServerConnection(serverName);//".\sqlexpress"
Server server = new Server(connection);
Restore restore = new Restore();
restore.Database = databaseName;//
//backupFileName e.g database.bak
restore.Devices.AddDevice(backupFileName, DeviceType.File);
restore.ReplaceDatabase = true;
restore.ReplaceDatabase = true;
restore.PercentCompleteNotification = 10;
server.KillAllProcesses(databaseName);
restore.Wait();
restore.SqlRestore(server);
MessageBox.Show("Database Restore success....", "Restore success", MessageBoxButtons.OK, MessageBoxIcon.None);
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.InnerException.ToString());
}
}
http://www.prpraveen.blogspot.com
using Microsoft.SqlServer.Management.Common;
using System.Windows.Forms;
public void RestoreDatabase(string databaseName,string backupFileName,String serverName)
{
try
{
ServerConnection connection = new ServerConnection(serverName);//".\sqlexpress"
Server server = new Server(connection);
Restore restore = new Restore();
restore.Database = databaseName;//
//backupFileName e.g database.bak
restore.Devices.AddDevice(backupFileName, DeviceType.File);
restore.ReplaceDatabase = true;
restore.ReplaceDatabase = true;
restore.PercentCompleteNotification = 10;
server.KillAllProcesses(databaseName);
restore.Wait();
restore.SqlRestore(server);
MessageBox.Show("Database Restore success....", "Restore success", MessageBoxButtons.OK, MessageBoxIcon.None);
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.InnerException.ToString());
}
}
http://www.prpraveen.blogspot.com
Posted by
Praveen P.R
Monday, September 21, 2009
Save a datetime into SQL Server 2005 in dd/MM/yyyy format By Praveen P.R
y//C#
//Save datetime in dd/MM/yyy formate into DataBase
//While Insert statement
e.g
Insert into ....purchaseDate="'+ DateTime.ParseExact(dateTimeField.Value.ToString("dd/MM/yyyy"), "dd/MM/yyyy", CultureInfo.InvariantCulture.DateTimeFormat)+"' .....;
//While Select statement
e.g
Select
convert(datetime,purchaseDate,103) =convert(datetime,'" + DateTime.ParseExact(dateTimeField.Value.ToString("dd/MM/yyyy"), "dd/MM/yyyy", CultureInfo.InvariantCulture.DateTimeFormat) + "',103) ,.........from tablename
http://www.prpraveen.blogspot.com
//Save datetime in dd/MM/yyy formate into DataBase
//While Insert statement
e.g
Insert into ....purchaseDate="'+ DateTime.ParseExact(dateTimeField.Value.ToString("dd/MM/yyyy"), "dd/MM/yyyy", CultureInfo.InvariantCulture.DateTimeFormat)+"' .....;
//While Select statement
e.g
Select
convert(datetime,purchaseDate,103) =convert(datetime,'" + DateTime.ParseExact(dateTimeField.Value.ToString("dd/MM/yyyy"), "dd/MM/yyyy", CultureInfo.InvariantCulture.DateTimeFormat) + "',103) ,.........from tablename
http://www.prpraveen.blogspot.com
Posted by
Praveen P.R
Datetime Null insertion to DataBase By Praveen P.R
//C#
//Datetime Null insertion to DB
using System.Data.SqlTypes;
//Any Datetime variable
//e.g dtToday
dtToday= SqlDateTime.Null;
http://www.prpraveen.blogspot.com
//Datetime Null insertion to DB
using System.Data.SqlTypes;
//Any Datetime variable
//e.g dtToday
dtToday= SqlDateTime.Null;
http://www.prpraveen.blogspot.com
Posted by
Praveen P.R
Sunday, September 20, 2009
DataGridView ComboBox Single click DropDown By Praveen P.R
// C#//It is also possible to drop down the comboboxlist using the DataGridViewComboBoxEditingControl when catching a mouse event:
private void dgvCompanyList_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
{
if(dgvCompanyList[e.ColumnIndex, e.RowIndex].EditType.ToString() == "System.Windows.Forms.DataGridViewComboBoxEditingControl")
{
DataGridViewColumn column = dgvCompanyList.Columns[e.ColumnIndex];
if (column is DataGridViewComboBoxColumn)
{
DataGridViewComboBoxCell cell = (DataGridViewComboBoxCell)dgvCompanyList[e.ColumnIndex, e.RowIndex];
dgvCompanyList.CurrentCell = cell;
dgvCompanyList.BeginEdit(true);
DataGridViewComboBoxEditingControl editingControl = (DataGridViewComboBoxEditingControl)dgvCompanyList.EditingControl;
editingControl.DroppedDown = true;
}
}
}
http://www.prpraveen.blogspot.com
private void dgvCompanyList_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
{
if(dgvCompanyList[e.ColumnIndex, e.RowIndex].EditType.ToString() == "System.Windows.Forms.DataGridViewComboBoxEditingControl")
{
DataGridViewColumn column = dgvCompanyList.Columns[e.ColumnIndex];
if (column is DataGridViewComboBoxColumn)
{
DataGridViewComboBoxCell cell = (DataGridViewComboBoxCell)dgvCompanyList[e.ColumnIndex, e.RowIndex];
dgvCompanyList.CurrentCell = cell;
dgvCompanyList.BeginEdit(true);
DataGridViewComboBoxEditingControl editingControl = (DataGridViewComboBoxEditingControl)dgvCompanyList.EditingControl;
editingControl.DroppedDown = true;
}
}
}
http://www.prpraveen.blogspot.com
Posted by
Praveen P.R
Monday, September 14, 2009
GlassButton / Custom button C# By Praveen P.R
http://www.prpraveen.blogspot.com
Codeproject
* GlassButton - How to create an animating glass button using only GDI+ (and not using WPF). *
* *
* Original developed by Łukasz Świątkowski - lukasz.swiatkowski@gmail.com *
* Form-/Perfomance-/Behavior-Improvements by Fink Christoph - fink.christoph@gmail.com *
* *
* Perfomance-Timer stoped for slow systems
* Feel free to use this control in your application or to improve it in any way! *
***********************************************************************************************/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
using System.Drawing.Text;
using PushButtonState = System.Windows.Forms.VisualStyles.PushButtonState;
namespace EnhancedGlassButton
{
///
/// Represents a glass button control.
///
[ToolboxBitmap(typeof(System.Windows.Forms.Button)), ToolboxItem(true), ToolboxItemFilter("System.Windows.Forms"), Description("Raises an event when the user clicks it.")]
public partial class GlassButton : Button
{
# region " Global Vareables "
# region " Vareables for Drawing "
Codeproject
* GlassButton - How to create an animating glass button using only GDI+ (and not using WPF). *
* *
* Original developed by Łukasz Świątkowski - lukasz.swiatkowski@gmail.com *
* Form-/Perfomance-/Behavior-Improvements by Fink Christoph - fink.christoph@gmail.com *
* *
* Perfomance-Timer stoped for slow systems
* Feel free to use this control in your application or to improve it in any way! *
***********************************************************************************************/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
using System.Drawing.Text;
using PushButtonState = System.Windows.Forms.VisualStyles.PushButtonState;
namespace EnhancedGlassButton
{
///
/// Represents a glass button control.
///
[ToolboxBitmap(typeof(System.Windows.Forms.Button)), ToolboxItem(true), ToolboxItemFilter("System.Windows.Forms"), Description("Raises an event when the user clicks it.")]
public partial class GlassButton : Button
{
# region " Global Vareables "
# region " Vareables for Drawing "
Posted by
Praveen P.R
Sunday, September 6, 2009
Set Focus to a control on Form Load C# by Praveen P.R
// On form Load as required
this.ActiveControl = controlName;
this.ActiveControl = controlName;
Posted by
Praveen P.R
Subscribe to:
Posts (Atom)