Saturday, December 9, 2017

How to setup in visual studio 2013,2017 ?

How to setup in visual studio 2013,2017

                                                                   This article is explain how to setup in visual studio 2013.First of all download visual studio 2013 setup then follow step below.

1) First of all setup double click 


2) Then open visual studio 2013 dialog box then click continue button show below image.


3) Third step is by default path is set "C:\Program Files\Microsoft Visual Studio 12.0". it can change path and set new path otherwise default path store all file and setup data.

                                         Third step display "I Agree to the License Terms and Privacy Policy"
Checkbox by default un-selected display then select checkbox to display Next button.see image



4) Then Click Next Button see Image.


5) Fifth step display "Optional features to install" by default all selected. then click Install Button.See image



6) Six step is display progress bar in i think 40 minute process to install visual studio 2013 data.waiting in 40 minutes see image

7) Congratulation your setup is completed install and display dialog see image

8) Then click "LAUNCH" text 

9) Nine step to display  "Welcome Sign in to Visual Studio." then click "Not now,Maybe later " text.see image


10) This step is choose your color theme.there are three theme display
  1.  Blue
  2. Dark
  3. Light
Select a Blue color theme then click Start Visual Studio. see image


11) This step is display waiting few minute see image


12) Finally all process is finish display visual studio 2013 dialog.your are create own web application,Software etc.see image

Serial Port with Efficient Data reading in C#



  • I am  not good at writing but below is few from my collection.
  • Declare the Port variable globally in a form.


    1. SerialPort Port;   
    2. string PORT_NUMBER = "YOUR PORT NUMBER" ;   
  • Set the port properties in Form load. 

try  
{  
   Port = new SerialPort("COM" + PORT_NUMBER.ToString());  
   Port.BaudRate = 115200;  
   Port.DataBits = 8;  
   Port.Parity = Parity.None;  
   Port.StopBits = StopBits.One;  
   Port.Handshake = Handshake.None;  
   Port.DtrEnable = true;  
   Port.NewLine = Environment.NewLine;  
   Port.ReceivedBytesThreshold = 1024;  
   Port.Open();  
  
}  
catch (Exception ex)  
{  
   MessageBox.Show("Error accessing port." + Environment.NewLine + ex.Message, "Port Error!!!", MessageBoxButtons.OK);  
   Port.Dispose();  
   Application.Exit();  
}   
  
  • Above is the basic procedure and easy to understand.
  • Now create following function which will be helpful to read data from serial port simultaneously. 

private void ReadEvent()  
{
byte[] buffer = new byte[2000];  
Action kickoffRead = null;  
kickoffRead = (Action)(() => Port.BaseStream.BeginRead(buffer, 0, buffer.Length, delegate(IAsyncResult ar)  
{  
    try  
    {  
        int count = Port.BaseStream.EndRead(ar);  
        byte[] dst = new byte[count];  
        Buffer.BlockCopy(buffer, 0, dst, 0, count);  
        RaiseAppSerialDataEvent(dst);  
    }  
    catch (Exception exception)  
    {  
        MessageBox.Show(ERROR == > " + exception.ToString());    
    }  
    kickoffRead();  
}, null)); kickoffRead();  
}  

    //To decode the received data from the port.   
    private void RaiseAppSerialDataEvent(byte[] Data)  
    {  
        string Result = Encoding.Default.GetString(Data);  
         TextBox1.Invoke((Action)delegate   
    {  
       TextBox1.Text=Result; TextBox1.Refresh();   
    });   
    }  



    It will keep assigning same event when data received.

    Port.BaseStream.BeginRead 

    Never fails and will give you each and every bit from the Port.
    To invoke this you need to Call Port.WriteLine("AT COMMAND");
    Hope it helps someone who is stuck with ports.
     

    Sunday, December 3, 2017

    How to pass and get value in query string asp.net

    One page to another page pass value in query string :

    First pass value in query string: 

    Response.Redirect("QueryString.aspx?QueryString=" + txtQueryString.Text);

    Get QuerySting value in Asp.net:
     QueryString.Text = Request.QueryString["QueryString"];