D
D
d1zz72021-02-01 19:22:53
C++ / C#
d1zz7, 2021-02-01 19:22:53

How to call a non-static method?

There is a code:

static async void Bot_OnMessage(object sender, MessageEventArgs e)
        {
            Head hd = new Head();
            if (e.Message.Text != null && e.Message.Chat.Id == myChatId)
            {
                
                await botClient.SendTextMessageAsync(
                  chatId: myChatId,
                  text: "You said:\n" + e.Message.Text
                );
                hd.writeLog("sdgergergreg");
            }
        }
public void writeLog(string text)
    {
        logText.Text = logText.Text + DateTime.Now +  text // + "\n";
    }


hd.writeLog("sdgergergreg"); - here he should add "sdgergergreg" to the TextBox, but nothing is added there.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question