sheepshower 0 Newbie Poster

I am receiving a 'Cannot convert type 'bool' to 'int'" error, while using BitVector32.Section. I am trying to make ints, not booleans. I used this previously in the same way and it worked.

Here is my code. I am passing it an Int32. Thank you for anyone who can tell me why I am receiving this error.

public class ReadDopFixAlt
    {
        private BitVector32.Section sectAlt1;
        private BitVector32.Section sectAlt2;
        private BitVector32.Section sectFix;
        private BitVector32.Section sectDGPS;
        private BitVector32.Section sectHDOP;
        
        public ReadDopFixAlt()
        {
            sectAlt1 = BitVector32.CreateSection(32767);
            sectAlt2 = BitVector32.CreateSection(15, sectAlt1);
            sectFix = BitVector32.CreateSection(3, sectAlt2);
            sectDGPS = BitVector32.CreateSection(1, sectFix);
            sectHDOP = BitVector32.CreateSection(1023, sectDGPS);        
        }

        public string ParseDopFixAlt(int data)
        {
            // Create an instance of BitVector32 using
            // the data passed to this method.
            BitVector32 wrd = new BitVector32(data);

            int Alt1 = wrd[Alt1];
            int Alt2 = wrd[Alt2];
            int Fix = wrd[Fix];
            int DGPS = wrd[DGPS];
            int HDOP = wrd[HDOP];
                    

            StringBuilder tb = new StringBuilder();
            tb.Append(Fix.ToString() + ',' + ' ');
            tb.Append(DGPS.ToString() + ',' + ' ');
            tb.Append(HDOP.ToString() + ',' + ' ');            
            tb.Append(Alt1.ToString());
            return tb.ToString();
        }
    }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.