Tuesday 18 December 2012

How to Prevent the Focus on datagridview columns in c#.net windows applications

Some times we need to prevent(avoid) the focus on some columns in datagridview,mostly these requirment for ReadOnly columns for that i gave some code for that,here which column is required for prevent the focus those columns are should be ReadOnly and write below code in CellEnter Event in datagridview.

 private void dgv_CellEnter(object sender, DataGridViewCellEventArgs e)
        {
            if (dgv.CurrentRow.Cells[e.ColumnIndex].ReadOnly)
            {
                SendKeys.Send("{tab}");
            }

        }
See below image:
Here Sl.No and Debit columns are ReadOnly so these two columns are out of focus.


I hope this code will help you.
Read more ►

Wednesday 5 December 2012

How to Clear the All the controls in a form in c#.net in Realtime

In every project we have to Clear the controls which is nothing but NEW button,in our project whenever
we press the NEW button for new form it clear the all the controls in current form.For that we I gave
class(DLL)file with code using this DLL Clear all the controls in your form even the controls are inside the TAB Control or SplitContainer or etc shown below.
Code:

    public  void ClearFields(Control cntr)
        {
            foreach (Control ct in cntr.Controls)
            {             
                if (ct is TextBox)
                {
                    ((TextBox)ct).Clear();
                }
                else if (ct.HasChildren)
                {
                    ClearFields(ct);
                }
                else if (ct is ComboBox)
                {
                    ((ComboBox)ct).SelectedIndex = -1;
                }
                else if (ct is RichTextBox)
                {
                    ((RichTextBox)ct).Clear();
                }
                else if (ct is DataGridView)
                {
                    ((DataGridView)ct).Rows.Clear();
                }
            }
        }

Creat the class with this code and invoke into your application and call the method in your NEW button.
I hope this code willl help you.
Read more ►

Tuesday 4 December 2012

How to create the Usercontrol and How to use this usercontrol in Realtime C#.net

Working with usercontrol is very efficient to the application for that follow below steps.
step1:How to create the user control
Goto visual studio-->click on file-->click on new-->click on project-->select windows from visual c#
left side and select windows forms control library template and type the Application name(textbox).
step2:
 Goto .cs file and try with this following code
write in the key_press event
code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace textbox
{
    public partial class UserControl1 : UserControl
    {
        public UserControl1()
        {
            InitializeComponent();
        }
        private void UserControl1_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (char.IsDigit(e.KeyChar) == false)
            {
                MessageBox.Show("Digits Only Can Accept");
                e.Handled = true;
            }

        }
        public override string Text
        {
            get{ return base.Text;}
            set{ base.Text = value}
        }
    }
}
Build the Application,It creates DLL for user control
step3:How to use that usercontrol
Consuming or Adding  DLL to our our IDE.
Create a new windows forms application,Goto ToolBox-->Rightclick on toolbox-->ADD tab-->Type usercontrols-->
Right click-->click on choose items-->selet .net framework component tab page-->click on browse-->goto DLL location-->
select the textbox DLL-->click on open-->click on ok.This wiil add the user control to the toolbox.
you can use it as textbox.
Read more ►

Thursday 22 November 2012

karnataka SSLC/10th 2013 Time Table and Results

Karnataka Secondary Education Examination Board was established in the year 1966. Karnataka Education Board conducting SSLC and other examinations. Every year the students strength is increasing tremendously.
  Karnataka Board has made result script especially for all the appeared students, which can produce SSLC/10th class exam results 2013 just enter by roll number.For karnataka SSLC/10th Class Results 2013 Click Here 
 A large number to students can be check their through online from Karnataka Examination Results  official website.In this web site you get  SSLC-Examination Results by giving the Registration Number.And  for more complete details of Karnataka Examination Results 2012(PUC,SSLC,CET)  Click Here.
 Students here in this web page through you can find and download your Karnataka Board 10th/SSLC , 1st 2nd PUC Exam results 2013 using by roll number or admit card / hall ticket number. Students you can see result view link in below. Our team attach given link direct Karnataka Board official website.
Karnataka SSLC Time Table 2013
The Karnataka Board of education was coming in 1966. This board of education is funded by the govt of Karnataka. There are many public and private schools are affiliated with this board of education. In the Karnataka Board 4 lakh students are enrolled in it. There are many kinds  of subject are also studied. The exam papers are provided in the English, Tamil and many more according to the students.
The SSLC (10th) class will be conducted in April so all the students are starting their studies. The Karnataka SSLC board timetable 2013 will be updated very soon.All the students keep in touch with the official website of the university.

All the best for Every SSLC 2013 Student The Karnataka SSLC date sheet will be shown on the official website at www.kseeb.kar.nic.in/
Read more ►

Wednesday 21 November 2012

RealTime Dotnet Interview questions

1) What is .NET?
Ans:NET is a general-purpose software development platform, similar to Java. At
its core is a virtual machine that turns intermediate language (IL) into
machine code. High-level language compilers for C#, VB.NET and C++ are
 provided to turn source code into IL. C# is a new programming language,
very similar to Java.
2) what are features of C#?
Ans: 1) It supports intellisense.
         2) It is strong oops language ie. object oriented language.
3) what is class ?
Ans: class is collection of class.
4)When was .NET announced?
Ans:Bill Gates delivered a keynote at Forum 2000, held June 22, 2000, outlining
 the .NET 'vision'. The July 2000 PDC had a number of sessions on .NET
 technology, and delegates were given CDs containing a pre-release version
 of the .NET framework/SDK and Visual Studio.NET.
5) what is reference type ?
Ans:only string and object comes under reference type
6) what is value type ?
Ans:All data types except string and object comes under value type.
7) what is package ?
Ans:
package is nothing but collection of class.
8) what is access specifier ?
Ans:when you want to define scope of data then we require Access specifier.
9)What versions of .NET are there?
Ans:The final version of the 1.0 SDK and runtime was made publicly available
 around 6pm PST on 15-Jan-2002. At the same time, the final version of
 Visual Studio.NET was made available to MSDN subscribers.
 .NET 1.1 was released in April 2003 - it's mostly bug fixes for 1.0.
 .NET 2.0 is expected in 2005.
10)What operating systems does the .NET Framework run on?
Ans:The runtime supports Windows Server 2003, Windows XP, Windows 2000,
  NT4 SP6a and Windows ME/98. Windows 95 is not supported. Some parts of
  the framework do not work on all platforms - for example, ASP.NET is only
  supported on XP and Windows 2000/2003. Windows 98/ME cannot be used
  for development.
11) what is namespace ?
Ans : namespace is a keyword use to declare scope.
12) what is the use of keyword using ?
Ans:when you want to import namespace then we have to use using keyword
 ex: using system:
13) where value type is stored ?
Ans:
it is stored in stack memory.
14)What tools can I use to develop .NET applications?
Ans:There are a number of tools, described here in ascending order of cost:
  The .NET Framework SDK is free and includes command-line compilers
  for C++, C#, and VB.NET and various other utilities to aid
  development.
15) where reference type is stored ?
Ans: it is stored in heap memory.
Read more ►

How to Create the Setup(Deployment) file for Windows applications C#.net in RealTime

             In this Article Explain the How to create the setup file for C#.net windows applications in RealTime Projects.Before installation of our projects in client system we need create Setup file for our Project for run in the client system,for that i gave some steps To create the Setup file with default desktop shortcut,show below steps.
Open Visual Studio->File----->New----->Project----->Other Project Types----->Setup and Deployment----->Setup Project----->Give File Name----->Ok
File----->Add----->Existing Project----->Browse The Project
Right Click On File System on Target Machine----->Add Special Folder----->Program Files Folder
Right Click on Program Files Folder----->Add----->Project Output----->Select The Project----->Choose Primary Output----->Ok

Create Default Desktop Shortcut icon for this project: Select Program Files Folder for above
Right Click on Primary output from----->Create Shortcut to----->Rename The Shortcut
Drag the Shortcut to the User's Desktop Folder
And finally Build the project.Setup is created in our Project location.
I hope these Steps will help you.
Read more ►

How to insert the data from TextBox to dataGridview in C#.net in Realtime

In RealTime most of the windows based applications are used dataGridview for Inserting,Deleting,for any Modifications we use dataGridview .So for that the data will send to dataGridview from TextBox. I  gave some code for that shown below.
Code:using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace gridview
{
    public partial class Form1 : Form
    {  
        public Form1()
        {
            InitializeComponent();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            DataTable dt = new DataTable();
            DataRow dr;           
            dt.Columns.Add("Column1");
            dt.Columns.Add("Column2");
            dt.Columns.Add("Column3");
            dr = dt.NewRow();
            dr["column1"] = textBox1.Text;
            dr["column2"] = textBox2.Text;
            dr["column3"] = textBox3.Text;
            dt.Rows.Add(dr);
            dataGridView1.DataSource = dt
;          
        }
    }
}
                  Below image shows form with TextBoxes and DataGridView.
Below image shows TextBoxes and Data inserted from TextBoxes to Datagridview.
I hope this code will help you.
Read more ►