1
Answer

Use of unassigned Local variable 'Meter' problem

Mohammed Gamal

Mohammed Gamal

12y
2.4k
1
Dear all
Please in need help in this problem
i try to call class that have function "GetMeterItems" and that function returns array of string
Code of Class StockDB:-
static string[] MeterStr = new string[100];
        static Stock_3DataSetTableAdapters.MeterTableAdapter MeterTA = new global::Pricing.Stock_3DataSetTableAdapters.MeterTableAdapter();
        static Stock_3DataSet.MeterDataTable MeterDT = MeterTA.GetData();
        static DataRow[] MeterDR = MeterDT.Select();

        public string[] GetMeterItems()
        {
           
            int i = 0;
           
            foreach (var M in MeterDR)
            {
                MeterStr[i] = M.Field<string>("Type");
                i++;

            }
            return MeterStr;


But a face "Use of unassigned Local variable 'Meter'" problem

When call it in my program :-

StockDB Meter;
            string[] MeterStr =
Meter.GetMeterItems();

If there is any one can help me

Best regards


Answers (1)