Error 1 Operator '*' cannot be applied to operands of type 'method group' and 'double'

前端 未结 5 1805
难免孤独
难免孤独 2021-01-25 19:11

I believe what i am trying to do is very simple but I get the error. Operator \'*\' cannot be applied to operands of type \'method group\' and \'double\'

I want to mult

5条回答
  •  南笙
    南笙 (楼主)
    2021-01-25 19:43

    Do this:

    private void button1_Click(object sender, EventArgs e)
    {
        double rental;
    
        var dayRental = dayrental();
    
        if(checkBox1.Checked == true)
           rental = dayrental * 19.95;
    
        label4.Text = Convert.ToString(rental);  
    }
    
    private void label4_Click(object sender, EventArgs e)
    {
    
    }
    
    public int dayrental()
    {
         var timeSpan = dateTimePicker2.Value - dateTimePicker1.Value;
    
         var rentalDays = timeSpan.Days;                      
    
         return rentalDays;
    }
    

提交回复
热议问题