Avatar of RIAS
RIAS
Flag for United Kingdom of Great Britain and Northern Ireland asked on

Better way of writing the code

Hello,

  Is there a better of writing this code rather than repetition:

    If Me.BtnEditRecordHotelID.Enabled = True Then
                    ClsFrmMain.FormatMessage(3, "HotelID Update : ", "", "HotelID Update")
                Else
                    ClsFrmMain.FormatMessage(3, "HotelID Update : ", "", "HotelID Update")
                    Exit Sub
                End If

Open in new window


Cheers
Visual Basic.NET.NET Programming

Avatar of undefined
Last Comment
RIAS

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Paweł

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Ryan Chong

   ClsFrmMain.FormatMessage(3, "HotelID Update : ", "", "HotelID Update")

  If Me.BtnEditRecordHotelID.Enabled = False Then
        Exit Sub
End If

Open in new window

Rgonzo1971

Hi,

maybe
ClsFrmMain.FormatMessage(3, "HotelID Update : ", "", "HotelID Update")
If Me.BtnEditRecordHotelID.Enabled = False Then Exit Sub

Open in new window

Regards
RIAS

ASKER
Cheers!
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck