Click here to Skip to main content
15,867,838 members
Home / Discussions / C#
   

C#

 
AnswerRe: User Control function C# Pin
Gerry Schmitz28-Jul-20 6:53
mveGerry Schmitz28-Jul-20 6:53 
AnswerRe: User Control function C# Pin
BillWoodruff28-Jul-20 16:55
professionalBillWoodruff28-Jul-20 16:55 
AnswerRe: User Control function C# Pin
Ralf Meier28-Jul-20 21:04
professionalRalf Meier28-Jul-20 21:04 
GeneralRe: User Control function C# Pin
Ismael_199929-Jul-20 10:04
Ismael_199929-Jul-20 10:04 
GeneralRe: User Control function C# Pin
Ralf Meier29-Jul-20 20:30
professionalRalf Meier29-Jul-20 20:30 
GeneralRe: User Control function C# Pin
Ismael_199930-Jul-20 4:03
Ismael_199930-Jul-20 4:03 
GeneralRe: User Control function C# Pin
Ralf Meier30-Jul-20 6:15
professionalRalf Meier30-Jul-20 6:15 
GeneralRe: User Control function C# Pin
Ismael_199931-Jul-20 6:47
Ismael_199931-Jul-20 6:47 
Hi, Ralf.
My system has a main form which is used as an MDI Parent. From it the user can access many other screens to control the system. Some of these screens make the registration of clients, suppliers, banks and others. In these registration screens, there are fields connected to columns in tables. When fields are mandatory, the system must verify what was written there. That’s my problem. At this moment this verification is working well, but it does not warn the user about a wrong entry or an empty field which should be filled. My User Control now has the following code:
        private void SalvarButton_Click(object sender, EventArgs e)
        {
            if (PermSalvar)
            {
                ClickSalvar?.Invoke(this, e);
                EmEdicao = false;
            }
        }
I created a variable (PermSalvar) which indicates whether the data can be saved. In the main program there is a routine named ValidaCampos which is called in the leave moment of the fields of interest, as you can see below.
        private void ValidaCampos()
        {
            if (tb_Nome.Text == "")
                botoes1.PermSalvar = false;
            else
                botoes1.PermSalvar = true;


            if ((tb_Id.Text == "") || (!int.TryParse(tb_Id.Text, out int cp)))
                botoes1.PermSalvar = false;
            else
                botoes1.PermSalvar = true;
        }
        private void tb_Nome_Leave(object sender, EventArgs e)
        {
            ValidaCampos();
        }
        private void tb_Id_Leave(object sender, EventArgs e)
        {
            ValidaCampos();
        }
So, if you could give me any advice, it would be very welcome.
Thank you.

GeneralRe: User Control function C# Pin
Gerry Schmitz31-Jul-20 7:48
mveGerry Schmitz31-Jul-20 7:48 
GeneralRe: User Control function C# Pin
Ismael_199931-Jul-20 10:36
Ismael_199931-Jul-20 10:36 
GeneralRe: User Control function C# Pin
Ralf Meier31-Jul-20 8:22
professionalRalf Meier31-Jul-20 8:22 
GeneralRe: User Control function C# Pin
Ismael_199931-Jul-20 10:39
Ismael_199931-Jul-20 10:39 
GeneralRe: User Control function C# Pin
Ralf Meier31-Jul-20 11:20
professionalRalf Meier31-Jul-20 11:20 
GeneralRe: User Control function C# Pin
Ismael_19991-Aug-20 1:57
Ismael_19991-Aug-20 1:57 
GeneralRe: User Control function C# Pin
Ralf Meier1-Aug-20 22:49
professionalRalf Meier1-Aug-20 22:49 
Questioncall a jquery function inside html returned by ajax Pin
Peq 227-Jul-20 21:36
Peq 227-Jul-20 21:36 
AnswerRe: call a jquery function inside html returned by ajax Pin
OriginalGriff27-Jul-20 22:02
mveOriginalGriff27-Jul-20 22:02 
QuestionAdd a listview cell Pin
ago248627-Jul-20 1:34
ago248627-Jul-20 1:34 
AnswerRe: Add a listview cell Pin
OriginalGriff27-Jul-20 2:28
mveOriginalGriff27-Jul-20 2:28 
GeneralRe: Add a listview cell Pin
ago248627-Jul-20 2:31
ago248627-Jul-20 2:31 
GeneralRe: Add a listview cell Pin
OriginalGriff27-Jul-20 2:59
mveOriginalGriff27-Jul-20 2:59 
GeneralRe: Add a listview cell Pin
ago248627-Jul-20 3:18
ago248627-Jul-20 3:18 
GeneralRe: Add a listview cell Pin
OriginalGriff27-Jul-20 3:37
mveOriginalGriff27-Jul-20 3:37 
GeneralRe: Add a listview cell Pin
ago248627-Jul-20 4:08
ago248627-Jul-20 4:08 
GeneralRe: Add a listview cell Pin
OriginalGriff27-Jul-20 4:38
mveOriginalGriff27-Jul-20 4:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.