Click here to Skip to main content
15,881,812 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,
I'm starting to learn C# in .NET Core 5, I know something about C# in the .NET Framework... But one of the different things I'm seeing in .NET Core is that in place of the MessageBox there is now the TaskDialog. 
Well, I created a message using the TaskDialog (which can be seen on this link: https://ibb.co/y0Nt5Nx ), except for the textBox which I drew in Paint for the purpose of better illustrating my question.
My question is: how do I insert a textBox and how do I get the value typed by the user in that textBox to be used after that window is closed?


What I have tried:

I have searched and read many examples of TaskDialog available on the Web, but I haven't found exactly what I'm looking for, or I'm not quite sure how to apply it to my code below:


C#
var page = new TaskDialogPage()
            {
                Heading = "Input time in minutes:",
                Text = "Input time in minutes:",
                Icon = TaskDialogIcon.ShieldWarningYellowBar,
                Buttons =
                {
                    TaskDialogButton.Close
                }
            };

            var executeButton = new TaskDialogCommandLinkButton("&Execute");
            page.Buttons.Add(executeButton);

            executeButton.ShowShieldIcon = true;
Posted
Updated 12-Apr-21 7:20am
v3
Comments
Richard MacCutchan 5-Apr-21 9:44am    
The TaskDialog does not include a TextBox, it is similar to a Messagebox in that it is used only to display information. If you want input fields as well then you need to create a dialog form.

1 solution

Hello Lazie,
I believe that you may want to use System.Windows ShowDialog instead of Windows Controls TaskDialog from the Win32 API. For C# .Net Core 5 the ShowDialog is normally used.

system.windows.window.showdialog

I suppose the System.Windows.Window.ShowDialog will run anywhere that the .Net Core 5 runs. Have you already arrived at this conclusion?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900