VB.NET first day

xiaoxiao2021-03-06  103

OK, skipping simple steps, let's go straight, VB.NET's new data type: decimal, come and compare with previous Double

Decimal 12-byte 64-bit floating point number replaces the current currency Type Double 08 byte 28-bit decimal value is larger than DECIMAL, but will generate carry errors

Remember this thing, Decimal, Decimal, DECIMAL

In the string, the new function substring will replace the past Right, Left, and MID, two examples can explain everything: s.SUBSTRING (0, 2) 'is equivalent to Left (s, 2) s.substring (s. LengHT, -4) 'is equivalent to Right (s, 4)

Pay attention to a new thing, Len (s) is equivalent to S.LENGHT

In the Date type, the new class DATEANDTIME is introduced, and there is also the following example: mydate = dateandTime.nowMyweekDayName = DateandTime.WeekDayName (1) & mydate.toString

Next, look at the change in custom type. In VB6, we are used to define custom types with Type, and in VB.NET, you need to change to: Structure renname public ren1 AS STRINGEND STRUCTURE

Array All in .NET performs as a dynamic array, you can redefine the length at any time, and the lower bound is fixed to 0.dim arl as new arraylist 'dynamically build an array list for j = 0 to 10 arl.add (j) Next J You can use the length of the array by the Length method: for j = 0 to arl.length-1 redefine array redim preserve method has been canceled, you can use the New method to redefine the array size: DIM x () as singlex = new Single (20) Access arrays like access collection: for i = 0 to ar.count-1 console.writeline (ar.tem (i)) Console.Writeline (Ar (i)) Next i Other new methods:

CLEAR Clear Array List Contains (Object) If you contain this object, return to TrueCopyTo (array) to copy an array list to a one-dimensional array indexof (Object) Returns the value of the first element insert (index, object) in the specified The location is inserted into an element REMOVE (Object) Remove the element from the list from the list to remove the element of the specified location from the list to sort the list.

In the multidimensional array, you can only use the Redim Preserve method to change the last one, which is the same in VB6, such as Redim Preserve Matrix (10, Ubound (Matrix, 2) 1

In addition to the calculation symbols in VB6, VB.NET finally introduced advanced assignment operators, such as i = 1 equivalent to i = i 1:

= = - = * = / = / = ^ = & = assignment number plus equal number reduction equal number to equalize floating point divided equal number tuals

Static variables Singresses Shared Appless AS INTEGER

Controls: The CommandButton object in VB6 changes to the Button object and the Text object is called the TextBox menu. It does not use the menu editor, but there is a dedicated control mainmenuradiobutton (option button) instead of optionbutton (Quantity box) Groupbox. The control group) instead of a number of controls that the FRAME control needs to be added in VB6, in VB.NET, changed to the general control in the toolbox

The method of displaying the form as a pattern form is no longer used to reform.show 1, Me is frmabout.showdialog ()

The form-independent form is not required to edit in the Resize event. You can determine the control of the control's docking position by setting the anchor property of the control, or you can use the code in the following initializecomponent during runtime. Set the location of the form: private subinitiRizeComponent () me.setdesktopbounds (0,0,800,600) End Subok, learn here today, take a break, haha

转载请注明原文地址:https://www.9cbs.com/read-124752.html

New Post(0)