How to align the Text property of the Textbox Control?
VB.NET TextBox1.Style(‘text-align’)=’right’ C# TextBox1.Style[‘text-align’]=’right’;
How to display only date part in the Datagrid if the Date is of DateTime datatype in the database
Set the DateFormatString as {0:d}
Why do I get the Columns twice in the datagrid. I am using BoundColumns and TemplateColumns in DataGrid
Set the AutogenerateColumns= False. By Default it is set to true for a datagrid
How do I force the changes in base class fields to be serialized via a base class property in the inherited type’s designer?
Sometimes you might want to let the designer serializer serialize the changes in base fields via a property rather than the field itself using the AccesssedThroughProperty attribute as follows: public class MyBaseForm : Form { [AccessedThroughProperty(‘MyList’)] private ArrayList myList; public ArrayList MyList { return this.myList; } } Then when the above form is inherited and items get added to the inherited form’s designer, code will be added as follows in the inherited form’s InitializeComponent: private void InitializeComponent() { … … … … this.MyList.Add(aNewItem); … … … … }
How can I prevent the beep when enter is hit in textbox?
You can prevent the beep when the enter key is pressed in a TextBox by deriving the TextBox and overriding OnKeyPress. [C#] public class MyTextBox : TextBox { protected override void OnKeyPress(KeyPressEventArgs e) { if(e.KeyChar == (char) 13) e.Handled = true; else base.OnKeyPress (e); } } [VB.NET] Public Class MyTextBox Inherits TextBox Protected Overrides Sub OnKeyPress(e As KeyPressEventArgs) If e.KeyChar = CChar(13) Then e.Handled = True Else MyBase.OnKeyPress(e) End If End Sub ’OnKeyPress End Class ’MyTextBox