Click here to Skip to main content
16,005,037 members
Home / Discussions / C#
   

C#

 
AnswerRe: Nullable Structs? Pin
PIEBALDconsult30-Jan-09 7:10
mvePIEBALDconsult30-Jan-09 7:10 
GeneralDisplay Image Using Webservice and JavaScript Pin
justindhas29-Jan-09 23:03
justindhas29-Jan-09 23:03 
GeneralRe: Display Image Using Webservice and JavaScript Pin
Manas Bhardwaj29-Jan-09 23:28
professionalManas Bhardwaj29-Jan-09 23:28 
GeneralRe: Display Image Using Webservice and JavaScript Pin
justindhas29-Jan-09 23:35
justindhas29-Jan-09 23:35 
Questionstarting windows service from windows form Pin
Mubeen.asim29-Jan-09 21:46
Mubeen.asim29-Jan-09 21:46 
AnswerRe: starting windows service from windows form Pin
Spunky Coder29-Jan-09 21:59
Spunky Coder29-Jan-09 21:59 
GeneralRe: starting windows service from windows form Pin
Mubeen.asim29-Jan-09 22:07
Mubeen.asim29-Jan-09 22:07 
Questionhow to Call values from An ARRAY like method. I have some configuration inside an array list. how can i call those values and declare?? Pin
Aghosh Babu29-Jan-09 21:37
Aghosh Babu29-Jan-09 21:37 
I have an array list of serial port configuration. i want to call these configuration later in the program. So how can i call the configuration from array ?

using System;
using System.Collections.Generic;
using System.Collections;
using System.Text;
using System.IO;
using System.Windows.Forms;
using System.IO.Ports;
using System.Threading;
using System.ComponentModel;
using System.Data;
using System.Drawing;


/// <summary>
/// Summary description for Class1
/// </summary>
public class Class1
{
    public Class1()
    {
    }

    public ArrayList SerialPortContainer = new ArrayList();

    private string config_file = "C:/achu/config.txt";
    private string PhoneNumber;
    private string ServiceCentre;



    public bool test()
    {
        try
        {
            //SerialPort serialPort1 = new SerialPort();
            
            string line;
            //string file = "C:/achu/config.txt";
            TextReader tr = new StreamReader(config_file);
            System.IO.StreamReader objReader;
            objReader = new System.IO.StreamReader(config_file);
            int NumberOfLines = 0;

            while ((line = tr.ReadLine()) != null)
            { 
                NumberOfLines++;
            }


            string[] ListLines = new string[NumberOfLines];

            for (int i = 0; i < NumberOfLines; i++)
            {
                ListLines[i] = objReader.ReadLine();
                //MessageBox.Show(Convert.ToString(ListLines[i]));

                
                string[] values = ListLines[i].Split(new char[] { '$', '#' });
                string[] PortSplit = values[0].Split(new char[] { ':', '#' });

                string PortName = PortSplit[1];
                

                
                //********Reading Baud Rate*********

                string[] BaudSplit = values[1].Split(new char[] { ':', '#' });
                //string BaudRateValue = BaudSplit[1];
                int BaudRate = Convert.ToInt32(BaudSplit[1]);
                
                //******READING DATA BITS**********
                string[] BitsSplit = values[2].Split(new char[] { ':', '#' });
                int DataBits = Convert.ToInt32(BitsSplit[1]);
                               

                //********READING SIM PHONE NUMBER********
                string[] NumberSplit = values[3].Split(new char[] { ':', '#' });
                PhoneNumber = NumberSplit[1];
                 

                
                //******READ SERVICE CENTRE NUMBER*********
                string[] SerNumberSplit = values[4].Split(new char[] { ':', '#' });
                ServiceCentre = SerNumberSplit[1];
                
                //******Setting Modem Configuration********
                SerialPort serialPort1 = new SerialPort();
                serialPort1.PortName = PortName;
                serialPort1.Handshake = Handshake.RequestToSend;
                serialPort1.BaudRate = BaudRate;
                serialPort1.DataBits = DataBits;
                serialPort1.Parity = Parity.None;
                serialPort1.StopBits = StopBits.One;
                serialPort1.DtrEnable = true;
                serialPort1.Open();
                //serialPort1 = new SerialPort();
                
                SerialPortContainer.Add(serialPort1); 
 //i want to call the above array values later in the below method called ATTest() to cal the configuration and do someting
                
              //  MessageBox.Show(Convert.ToString(SerialPortContainer.Count));
               // MessageBox.Show(Convert.ToString(SerialPortContainer[i]));

            }//end while
                
            
        }//end try
       catch (Exception ex)
        {

           MessageBox.Show(ex.Message);
            return false;
        }
        return true;
    }

    public void ATTest()
    {
        string val = Convert.ToString(SerialPortContainer[1]);
        MessageBox.Show(val);
    }

}

AnswerRe: how to Call values from An ARRAY like method. I have some configuration inside an array list. how can i call those values and declare?? Pin
Spunky Coder29-Jan-09 21:46
Spunky Coder29-Jan-09 21:46 
AnswerRe: how to Call values from An ARRAY like method. I have some configuration inside an array list. how can i call those values and declare?? Pin
SeMartens29-Jan-09 21:47
SeMartens29-Jan-09 21:47 
AnswerRe: how to Call values from An ARRAY like method. I have some configuration inside an array list. how can i call those values and declare?? Pin
Najmal29-Jan-09 22:03
Najmal29-Jan-09 22:03 
QuestionC# contactless smart cards Pin
Hristiyan29-Jan-09 21:28
Hristiyan29-Jan-09 21:28 
AnswerRe: C# contactless smart cards Pin
Dave Kreskowiak30-Jan-09 6:00
mveDave Kreskowiak30-Jan-09 6:00 
GeneralRe: C# contactless smart cards [modified] Pin
Hristiyan1-Feb-09 21:29
Hristiyan1-Feb-09 21:29 
GeneralRe: C# contactless smart cards Pin
Dave Kreskowiak2-Feb-09 1:54
mveDave Kreskowiak2-Feb-09 1:54 
GeneralRe: C# contactless smart cards Pin
Hristiyan2-Feb-09 21:57
Hristiyan2-Feb-09 21:57 
GeneralRe: C# contactless smart cards Pin
Ken Bodnar13-Mar-09 9:41
Ken Bodnar13-Mar-09 9:41 
QuestionWeb Browser Control & Dataset Pin
Tridip Bhattacharjee29-Jan-09 20:31
professionalTridip Bhattacharjee29-Jan-09 20:31 
AnswerRe: Web Browser Control & Dataset Pin
Vikram A Punathambekar29-Jan-09 21:17
Vikram A Punathambekar29-Jan-09 21:17 
QuestionIn MSSQL, how to know update query will affect any rows or not. Pin
S a n d y29-Jan-09 20:09
S a n d y29-Jan-09 20:09 
AnswerRe: In MSSQL, how to know update query will affect any rows or not. Pin
Spunky Coder29-Jan-09 21:18
Spunky Coder29-Jan-09 21:18 
GeneralRe: In MSSQL, how to know update query will affect any rows or not. Pin
S a n d y29-Jan-09 22:31
S a n d y29-Jan-09 22:31 
GeneralRe: In MSSQL, how to know update query will affect any rows or not. Pin
Spunky Coder29-Jan-09 22:54
Spunky Coder29-Jan-09 22:54 
AnswerRe: In MSSQL, how to know update query will affect any rows or not. Pin
Najmal29-Jan-09 21:40
Najmal29-Jan-09 21:40 
GeneralRe: In MSSQL, how to know update query will affect any rows or not. Pin
S a n d y29-Jan-09 22:33
S a n d y29-Jan-09 22:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.