Search code examples
c#skype4com

Skype4COM cannot convert string to bool


I am trying to make a program so if my Skype name/id is David it wont do anything but if its someone else Skype name/id it will change the RichMoodText I know how to change the RichMoodText but its just detecting if its a certain profile

Please Help

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using SKYPE4COMLib;

namespace Skype_Tools_2
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            //RMT Means RichMoodText
            string RMT = "Hi";
            //CFN Means Creators FullName
            string CFN = "David Fedrick";

            Skype skype = new Skype();
            skype.Attach();
            //skype.CurrentUserProfile.RichMoodText = RMT;

            if skype.CurrentUserProfile.FullName = CFN; <---- 
            Cannot implicitly convert type 'string' to 'bool'
        }
    }
}

Solution

  • = is an assignment operator. You should use comparison operators in if statements, in this case ==. Also the statement should be in parenthesis, like

    if (a == b)
    {
        \\ do your thing
    }