// MyForm.cs
private MyForm() { }
private string Foo()
{
// this would be called after ShowDialog returned
string s = "";
foreach (Label l in MyLabels)
s += l.Text;
}
// this would be called after ShowDialog returned
private int Bar => label1.Text.Length;
public static bool ShowMyForm(out string s, out int i)
{
using (MyForm f = new MyForm())
{
bool ok = f.ShowDialog() == DialogResult.OK;
// accessing Controls of f after ShowDialog returned
s = f.Foo();
i = f.Bar;
return ok; // User clicked OK or Cancel
}
}
// Other Form
void CallForm()
{
if (MyForm.ShowMyForm(out string s, out int i)
{
if (s == ...) { }
if (i == ...) { }
}
}
Ich frage mich, ob es sich um einen guten und gültigen Ansatz handelt, um auf die Formulare zuzugreifen. MyForm -Form, also würde ich darauf zugreifen, dass im Ui-Thread nach Showdialog zurückgegeben wird. Ist das problematisch?
Ich verwende einen Werks-Methoden-Ansatz in einer Form wie folgt: < /p> [code]// MyForm.cs private MyForm() { }
private string Foo() { // this would be called after ShowDialog returned string s = ""; foreach (Label l in MyLabels) s += l.Text; }
// this would be called after ShowDialog returned private int Bar => label1.Text.Length;
public static bool ShowMyForm(out string s, out int i) { using (MyForm f = new MyForm()) { bool ok = f.ShowDialog() == DialogResult.OK; // accessing Controls of f after ShowDialog returned s = f.Foo(); i = f.Bar; return ok; // User clicked OK or Cancel } }
// Other Form void CallForm() { if (MyForm.ShowMyForm(out string s, out int i) { if (s == ...) { } if (i == ...) { } } } [/code] Ich frage mich, ob es sich um einen guten und gültigen Ansatz handelt, um auf die Formulare zuzugreifen. MyForm -Form, also würde ich darauf zugreifen, dass im Ui-Thread nach Showdialog zurückgegeben wird. Ist das problematisch?
Ich bearbeite und hinterlasse eine Lösung am Ende, da es nicht gelöst werden kann. Kombiniert macht etwas Seltsames. Aber ich muss ShowcelltoolTips halten, um den Inhalt anzuzeigen.using System;...
Ich arbeite an einer C# WinForms -Anwendung auf .NET 8.0 und muss mit Formularen mit Formularen vorhanden sind.
Form1 - Anfangsbildschirm (Hauptformular)
Form2 - Passwortbildschirm (modales...
Ich habe eine nächste. Ich überprüfe die Sitemap in Vercel. Es gibt die erwarteten Ergebnisse zurück:
✅ Works
In Amplify gibt es jedoch einen 404 -Fehler zurück:
❌ 404 Not Found
Mein aktuelles...