h1.post-title { color:orange; font-family:verdana,Arial; font-weight:bold; padding-bottom:5px; text-shadow:#64665b 0px 1px 1px; font-size:32px; } -->

Pages

Delete Last character in String

Today, We will discuss about "Delete Last Character from String" using C#.Net


String varLength;
if (textBox1.Text.Length > 0)
{
varLength = textBox1.Text.Substring(0, textBox1.Text.Length - 1);
textBox1.Text = varLength;
}

Types of VB.net Statement:

Here, I give a Tye pf VB.Net Statement with explanation.  Three types of Statement in VB.Net.
  1.  Declaration Statements
  2.  Executable Statements
  3.  Assignment Statements
1) Declaration Statements:
    names of variables,Procedures,Properties ,arrays and constants.
Eg: Dim myName As New string ("Lakshmi Narayanan")
2) Executable Statements:
    Perform a specific action.
    call a procedure
     loop through several statements, or evaluate an expression.
3)Assignment Statements:
    Assignment Statements is also a type of Executable statement.
Me.Text = “Beginner Guide”

ShoutCut Keys in the TextBox


ShoutCut Keys in the TextBox
ShortKey Function
CTRL +H. Remove Last Character.
CTRL +Z. Select All Characters/Last Character in Text Box.
CTRL +X. Cut selected Characters in Text Box.
CTRL +C . Copy Selected Characters in Text Box.
CTRL +P. Paste Selected Characters in Text Box..

DataSet Vs Datareader

Dataset Vs DataReader
DataSet object DataReader object
Read/Write access. Read-only access.
Supports multiple tables from different databases. Supports a single table based on a single SQL query of one database.
Disconnected mode. Connected mode.
Bind to multiple controls . Bind to a single control.
Forward and backward scanning of data . Forward-only scanning of data.
Slower access to data . Faster access to data.
Greater overhead to enable additional features. Lightweight object with very little overhead.
Supported by Visual Studio .NET tools. Must be manually coded.

ExecuteReader,ExcuteNonQuery and ExecuteScaler

ExecuteReader
Use for accessing data. It provides a forward-only, read-only, connected record set.
ExecuteNonQuery
Use for data manipulation, such as Insert, Update, Delete.
ExecuteScalar
Use for retriving 1 row 1 col. value., i.e. Single value. eg: for retriving aggregate function. It is faster than other ways of retriving a single value from DB.

Structure vs Class

Structure Class
Value type and are stored on stack. Reference type and are stored on heap.
“do not support” inheritance. supports inheritance.
used when you want to use a small data structure. better choice for complex data structure.

Value Type vs Reference Type


Value Types Reference Types
All numeric data types. String.
Boolean, Char, and Date. All arrays, even if their elements are value types.
All structures, even if their members are reference types. Class types.
Enumerations, since their underlying type is always SByte, Short, Integer, Long, Byte, UShort, UInteger, or ULong. Delegates.

Boxing and unboxing with Example

Boxing:
Boxing is the Process of Converting a Value Type to the type Object.
Store a value type in the Garbage-Collection.

Unboxing:
              Unboxing is a explicit conversion from the type object to a Value Type.
Checking the object instance to make sure that it is a boxed value of the given value type.
Copying the value from the instance into the value-type variable.
 
Boxing Example:
Int i = 123; // a value type
Object o = i;
UnBoxing Example:
Int i = 123; // a value type
Object o = i;
Int j = (int) o; // UnBoxing
use of converting values:
based on your requirement.
For Example: I want to display a value in MessageBox.If my My value data type is Integer.So I want to convert that value into string .
Ex:
int i=10;
MessageBox.show(i.Tostring());
So I get a integer value into string

Structure vs Enumeration


Structure vs Enumeration
Enumeration Structure
Enumerations are a distinct type consisting of a set of named constants called the enumerator list. A structure is a value type and the instances or objects of a structure are created in stack.
Every enumeration type has an underlying type, which can be any integral type except char. A struct can contain fields, methods, constants, constructors, properties, indexers, operators and even other structure types.
Enumerations are integer-types that make code clearer and easier to maintain. Structs are similar to clases, but are intended to be used to group similar items of data together.

ListBox vs ComboBox

Combo Box List box
preferred Single Selection. short lists and multiple selections.
User can Edit a value at run Time. User can't Edit a value at run Time.