VS.NET 2003 控件命名规范

    技术2022-05-11  74

    1.变量命名规范

    类型前缀示例Array arrarrShoppingListBooleanblnblnIsPostBackBytebytbytPixelValueCharchrchrDelimiterDateTimedtmdtmStartDateDecimaldecdecAverageHeightDoubledbldblSizeofUniverseInteger intintRowCounterLong lnglngBillGatesIncomeObject objobjReturnValueShortshrshrAverageSingle sngsngMaximumString strstrFirstName

    2.控件命名规范

    类型前缀示例AdRotatoradrtadrtTopAdButtonbtnbtnSubmitCalendarcalcalMettingDatesCheckBoxchkchkBlueCheckBoxListchklchklFavColorsCompareValidatorvalcvalcValidAge CustomValidatorvalxvalxDBCheckDataGriddgrddgrdTitlesDataListdlstdlstTitlesDropDownListdropdropCountriesHyperLinklnklnkDetailsImageimgimgAuntBettyImageButtonibtnibtnSubmitLabellbllblResultsLinkButtonlbtnlbtnSubmitListBoxlstlstCountriesPanelpnlpnlForm2PlaceHolderplhplhFormContentsRadioButtonradradFemaleRadioButtonList radlradlGenderRangeValidatorvalgvalgAgeRegularExpressionvalevaleEmail_ValidatorRepeaterrptrptQueryResultsRequiredFieldValidatorvalrvalrFirstNameTabletbltblCountryCodes TableCelltblctblcGermanyTableRowtblrtblrCountryTextBoxtxttxtFirstNameValidationSummaryvalsvalsFormErrorsXMLxmlcxmlcTransformResults

    3.ADO.NET控件命名规范

    类型前缀示例ConnectionconconNorthwind CommandcmdcmdReturnProductsParameterparmparmProductIDDataAdapterdaddadProductsDataReaderdtrdtrProductsDataSetdstdstNorthWindDataTabledtbldtblProductDataRowdrowdrowRow98DataColumndcoldcolProductIDDataRelationdreldrelMasterDetailDataViewdvwdvwFilteredProducts

    4.事件处理子程序

    The name of an event-handling subroutine will consist of the ID of the control that rasied the event followed by the type of event being handled. For example, a subroutine named btnSubmit_Click handles the Click event of a Button control named btnSubmit.

    When a control that raises an event is not assigned an ID, the type of the control is used instead of the ID. For example, the subroutine named Button_Click handles the Click event of a Button control without an ID.

     

    最新回复(0)