Click here to Skip to main content
14,689,406 members
Home » Discussions » C#
   

C#

 
AnswerRe: User Control function C# Pin
Gerry Schmitz28-Jul-20 7:53
mveGerry Schmitz28-Jul-20 7:53 
AnswerRe: User Control function C# Pin
BillWoodruff28-Jul-20 17:55
mveBillWoodruff28-Jul-20 17:55 
AnswerRe: User Control function C# Pin
Ralf Meier28-Jul-20 22:04
professionalRalf Meier28-Jul-20 22:04 
GeneralRe: User Control function C# Pin
Member 1479239329-Jul-20 11:04
MemberMember 1479239329-Jul-20 11:04 
GeneralRe: User Control function C# Pin
Ralf Meier29-Jul-20 21:30
professionalRalf Meier29-Jul-20 21:30 
GeneralRe: User Control function C# Pin
Member 1479239330-Jul-20 5:03
MemberMember 1479239330-Jul-20 5:03 
GeneralRe: User Control function C# Pin
Ralf Meier30-Jul-20 7:15
professionalRalf Meier30-Jul-20 7:15 
GeneralRe: User Control function C# Pin
Member 1479239331-Jul-20 7:47
MemberMember 1479239331-Jul-20 7: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 8:48
mveGerry Schmitz31-Jul-20 8:48 
GeneralRe: User Control function C# Pin
Member 1479239331-Jul-20 11:36
MemberMember 1479239331-Jul-20 11:36 
GeneralRe: User Control function C# Pin
Ralf Meier31-Jul-20 9:22
professionalRalf Meier31-Jul-20 9:22 
GeneralRe: User Control function C# Pin
Member 1479239331-Jul-20 11:39
MemberMember 1479239331-Jul-20 11:39 
GeneralRe: User Control function C# Pin
Ralf Meier31-Jul-20 12:20
professionalRalf Meier31-Jul-20 12:20 
GeneralRe: User Control function C# Pin
Member 147923931-Aug-20 2:57
MemberMember 147923931-Aug-20 2:57 
GeneralRe: User Control function C# Pin
Ralf Meier1-Aug-20 23:49
professionalRalf Meier1-Aug-20 23:49 
Questioncall a jquery function inside html returned by ajax Pin
taiielmehdi00127-Jul-20 22:36
Membertaiielmehdi00127-Jul-20 22:36 
AnswerRe: call a jquery function inside html returned by ajax Pin
OriginalGriff27-Jul-20 23:02
mveOriginalGriff27-Jul-20 23:02 
QuestionAdd a listview cell Pin
ago248627-Jul-20 2:34
Memberago248627-Jul-20 2:34 
AnswerRe: Add a listview cell Pin
OriginalGriff27-Jul-20 3:28
mveOriginalGriff27-Jul-20 3:28 
GeneralRe: Add a listview cell Pin
ago248627-Jul-20 3:31
Memberago248627-Jul-20 3:31 
GeneralRe: Add a listview cell Pin
OriginalGriff27-Jul-20 3:59
mveOriginalGriff27-Jul-20 3:59 
GeneralRe: Add a listview cell Pin
ago248627-Jul-20 4:18
Memberago248627-Jul-20 4:18 
GeneralRe: Add a listview cell Pin
OriginalGriff27-Jul-20 4:37
mveOriginalGriff27-Jul-20 4:37 
GeneralRe: Add a listview cell Pin
ago248627-Jul-20 5:08
Memberago248627-Jul-20 5:08 
GeneralRe: Add a listview cell Pin
OriginalGriff27-Jul-20 5:38
mveOriginalGriff27-Jul-20 5: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.