Click here to Skip to main content
15,889,403 members
Home / Discussions / C#
   

C#

 
AnswerRe: when a method is called i want to get first index value from an arraylist and when the same methid is called nxt time i want to get the second index value from the same arraylist...how? Pin
Dragonfly_Lee31-Jan-09 21:18
Dragonfly_Lee31-Jan-09 21:18 
Questiontablelayoutpanel in c#.net in windows application Pin
dilipmca0431-Jan-09 20:05
dilipmca0431-Jan-09 20:05 
AnswerRe: tablelayoutpanel in c#.net in windows application Pin
dan!sh 31-Jan-09 21:53
professional dan!sh 31-Jan-09 21:53 
AnswerRe: tablelayoutpanel in c#.net in windows application Pin
Alan N31-Jan-09 21:57
Alan N31-Jan-09 21:57 
QuestionHow to call a string value from a method within another class? Pin
Aghosh Babu31-Jan-09 19:29
Aghosh Babu31-Jan-09 19:29 
AnswerRe: How to call a string value from a method within another class? Pin
Karmendra Suthar31-Jan-09 19:50
Karmendra Suthar31-Jan-09 19:50 
GeneralRe: How to call a string value from a method within another class? Pin
Aghosh Babu31-Jan-09 20:15
Aghosh Babu31-Jan-09 20:15 
GeneralRe: How to call a string value from a method within another class? Pin
Karmendra Suthar1-Feb-09 1:00
Karmendra Suthar1-Feb-09 1:00 
Think you need to re-visit OOPS concepts.

In button click event you have created another object sm and you have set sm.abc by running testMethod.

and you have never run SMSMdm.testMethod to set SMSMdm.abc, it wil give error also because you have never initialized SMSMdm.abc.

public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            SMSManager <big>sm</big> = new SMSManager();
        }
        public void sampleArray()
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {            
            sm.testMethod("82083427", "1122887779", "testmessagetxt");
        }
    }


class SMSManager
    {
        public string abc="";
        public void testMethod(string MPN, string RPN, string text)
        {
            SMSModem SMSMdm = new SMSModem();

            MessageBox.Show("RPN" + RPN);
            abc = RPN;  //this isnt wrking

            int x = myArray.Length / 5;
           
            for (int i = 0; i < x; i++)
            {
                string a = myArray[i, 0];
                if (a == MPN)
                {
                    MessageBox.Show("MODEM NUMBER :"+MPN);
                    SMSModem SMSM = new SMSModem();
                    SMSM.SendSms();
                }
            }
        }

class SMSModem
    {
public bool SendSms()
        {
            try
            {
                //this is not required now
                //SMSManager MGR = new SMSManager();
                //string num = MGR.abc;  //This is not retreiving the value!

                //I WANT THAT VALUE TO BE CALLED HERE AND ASSIGN IT TO "num"

                string num = <big>sm</big>.abc;
                MessageBox.Show("RECEIRE" +num);
         serialPort1.WriteLine("AT+CMGF=1;+CSCA=\"+6598540020\";+CMGS=\"+65" + num + "\"\r\n");
                System.Threading.Thread.Sleep(40);
                serialPort1.Write("Test message from coded program");

                char[] arr = new char[1];

                arr[0] = (char)26; //ascii value of Ctrl-Z

                serialPort1.Write(arr, 0, 1);

                System.Threading.Thread.Sleep(3000);
                string data = serialPort1.ReadExisting();

                MessageBox.Show(data);

                if (data.IndexOf("OK") != -1)
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
            catch
            {
                return false;
            }
        }
       
    }


Remember all these should be in same namespace.

Regards,
Karmendra
AnswerRe: How to call a string value from a method within another class? Pin
Dragonfly_Lee31-Jan-09 20:11
Dragonfly_Lee31-Jan-09 20:11 
QuestionProtect password file Pin
Karmendra Suthar31-Jan-09 19:27
Karmendra Suthar31-Jan-09 19:27 
AnswerRe: Protect password file Pin
Dragonfly_Lee31-Jan-09 20:02
Dragonfly_Lee31-Jan-09 20:02 
GeneralRe: Protect password file Pin
Karmendra Suthar1-Feb-09 0:53
Karmendra Suthar1-Feb-09 0:53 
GeneralRe: Protect password file Pin
Dave Kreskowiak1-Feb-09 1:45
mveDave Kreskowiak1-Feb-09 1:45 
GeneralRe: Protect password file Pin
Dragonfly_Lee1-Feb-09 4:05
Dragonfly_Lee1-Feb-09 4:05 
Questionfile upload error Pin
George_George31-Jan-09 19:22
George_George31-Jan-09 19:22 
AnswerRe: file upload error Pin
Anthony Mushrow1-Feb-09 2:17
professionalAnthony Mushrow1-Feb-09 2:17 
GeneralRe: file upload error Pin
George_George1-Feb-09 13:59
George_George1-Feb-09 13:59 
Questioncan we add for loop into an arraylist?how? Pin
merryjoy00031-Jan-09 19:19
merryjoy00031-Jan-09 19:19 
AnswerRe: can we add for loop into an arraylist?how? Pin
Dragonfly_Lee31-Jan-09 20:13
Dragonfly_Lee31-Jan-09 20:13 
AnswerRe: can we add for loop into an arraylist?how? Pin
Alan Balkany2-Feb-09 4:00
Alan Balkany2-Feb-09 4:00 
QuestionHow to set JIT type? Pin
Dragonfly_Lee31-Jan-09 19:07
Dragonfly_Lee31-Jan-09 19:07 
AnswerRe: How to set JIT type? Pin
Christian Graus31-Jan-09 22:15
protectorChristian Graus31-Jan-09 22:15 
GeneralRe: How to set JIT type? Pin
Dragonfly_Lee31-Jan-09 22:41
Dragonfly_Lee31-Jan-09 22:41 
AnswerRe: How to set JIT type? Pin
Eddy Vluggen31-Jan-09 23:20
professionalEddy Vluggen31-Jan-09 23:20 
GeneralRe: How to set JIT type? Pin
Dragonfly_Lee1-Feb-09 0:54
Dragonfly_Lee1-Feb-09 0:54 

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.