1.变量命名规范
类型前缀示例Array arrarrShoppingListBooleanblnblnIsPostBackBytebytbytPixelValueCharchrchrDelimiterDateTimedtmdtmStartDateDecimaldecdecAverageHeightDoubledbldblSizeofUniverseInteger intintRowCounterLong lnglngBillGatesIncomeObject objobjReturnValueShortshrshrAverageSingle sngsngMaximumString strstrFirstName2.控件命名规范
类型前缀示例AdRotatoradrtadrtTopAdButtonbtnbtnSubmitCalendarcalcalMettingDatesCheckBoxchkchkBlueCheckBoxListchklchklFavColorsCompareValidatorvalcvalcValidAge CustomValidatorvalxvalxDBCheckDataGriddgrddgrdTitlesDataListdlstdlstTitlesDropDownListdropdropCountriesHyperLinklnklnkDetailsImageimgimgAuntBettyImageButtonibtnibtnSubmitLabellbllblResultsLinkButtonlbtnlbtnSubmitListBoxlstlstCountriesPanelpnlpnlForm2PlaceHolderplhplhFormContentsRadioButtonradradFemaleRadioButtonList radlradlGenderRangeValidatorvalgvalgAgeRegularExpressionvalevaleEmail_ValidatorRepeaterrptrptQueryResultsRequiredFieldValidatorvalrvalrFirstNameTabletbltblCountryCodes TableCelltblctblcGermanyTableRowtblrtblrCountryTextBoxtxttxtFirstNameValidationSummaryvalsvalsFormErrorsXMLxmlcxmlcTransformResults3.ADO.NET控件命名规范
类型前缀示例ConnectionconconNorthwind CommandcmdcmdReturnProductsParameterparmparmProductIDDataAdapterdaddadProductsDataReaderdtrdtrProductsDataSetdstdstNorthWindDataTabledtbldtblProductDataRowdrowdrowRow98DataColumndcoldcolProductIDDataRelationdreldrelMasterDetailDataViewdvwdvwFilteredProducts4.事件处理子程序
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.