- Код: Выделить всё
stroka="1.234"
перевести в нецелое число?
Dim p As Single
p = stroka
Dim p As Single
p = Val(stroka)
KIV писал(а):Val может не сработать зависит от разделителя "," или "."
он был бы совершенно прав. А с CDbl() это не универсально.Replace(str,",",".") и юзай Val
'System metrics and locale
Public Enum SystemMetricConstants
smCXScreen = 0 'X Size of screen
smCYScreen = 1 'Y Size of Screen
smCXVScroll = 2 'X Size of arrow in vertical scroll bar.
smCYHScroll = 3 'Y Size of arrow in horizontal scroll bar
smCYCaption = 4 'Height of windows caption
smCXBorder = 5 'Width of non-sizable borders
smCYBorder = 6 'Height of non-sizable borders
smCXDlgFrame = 7 'Width of dialog box borders
smCYDlgFrame = 8 'Height of dialog box borders
smCYHThumb = 9 'Height of scroll box on horizontal scroll bar
smCXHThumb = 10 'Width of scroll box on horizontal scroll bar
smCXIcon = 11 'Width of standard icon
smCYIcon = 12 'Height of standard icon
smCXCursor = 13 'Width of standard cursor
smCYCursor = 14 'Height of standard cursor
smCYMenu = 15 'Height of menu
smCXFullScreen = 16 'Width of client area of maximized window
smCYFullScreen = 17 'Height of client area of maximized window
smCYKanjiWindow = 18 'Height of Kanji window
smMousePresent = 19 'True is a mouse is present
smCYVScroll = 20 'Height of arrow in vertical scroll bar
smCXHScroll = 21 'Width of arrow in vertical scroll bar
smDebug = 22 'True if deugging version of windows is running
smSwapButton = 23 'True if left and right buttons are swapped.
smCXMin = 28 'Minimum width of window
smCYMin = 29 'Minimum height of window
smCXSize = 30 'Width of title bar bitmaps
smCYSize = 31 'Height of title bar bitmaps
smCXMinTrack = 34 'Minimum tracking width of window
smCYMinTrack = 35 'Minimum tracking height of window
smCXDoubleClk = 36 'Double click width
smCYDoubleClk = 37 'Double click height
smCXIconSpacing = 38 'Width between desktop icons
smCYIcomSpacing = 39 'Height between desktop icons
smMenuDropAlignment = 40 'Zero if popup menus are aligned to the left of the memu bar item. True if it is aligned to the right.
smPenWindows = 41 'The handle of the pen windows DLL if loaded.
smDBCSEnabled = 42 'True if double byte characteds are enabled
smCMouseButtons = 43 'Number of mouse buttons.
smCMetrics = 44 'Number of system metrics
smCleanBoot = 67 'Windows 95 boot mode. 0 = normal, 1 = safe, 2 = safe with network
smCXMaximized = 61 'Default width of win95 maximised window
smCXMaxTrack = 59 'Maximum width when resizing win95 windows
smCXMenuCheck = 71 'Width of menu checkmark bitmap
smCXMenuSize = 54 'Width of button on menu bar
smCXMinimized = 57 'Width of rectangle into which minimised windows must fit.
smCYMaximized = 62 'Default height of win95 maximised window
smCYMaxTrack = 60 'Maximum width when resizing win95 windows
smCYMenuCheck = 72 'Height of menu checkmark bitmap
smCYMenuSize = 55 'Height of button on menu bar
smCYMinimized = 58 'Height of rectangle into which minimised windows must fit.
smCYSmCaption = 51 'Height of windows 95 small caption
smMidEastEnabled = 74 'Hebrw and Arabic enabled for windows 95
smNetwork = 63 'Bit o is set if a network is present.
smSecure = 44 'True if security is present on windows 95 system
smSlowMachine = 73 'True if machine is too slow to run win95.
End Enum
Public Declare Function GetSystemMetrics Lib "user32" ( _
ByVal nIndex As SystemMetricConstants) _
As Long
Public Enum LocaleInfoConstants
liICentury = &H24 ' century format specifier
liICountry = &H5 ' country code
liICurrDigits = &H19 ' # local monetary digits
liICurrency = &H1B ' positive currency mode
liIDate = &H21 ' short date format ordering
liIDayLZero = &H26 ' leading zeros in day field
liIDefaultCodePage = &HB ' default code page
liIDefaultCountry = &HA ' default country code
liIDefaultLanguage = &H9 ' default language id
liIDigits = &H11 ' number of fractional digits
liIIntlCurrDigits = &H1A ' # intl monetary digits
liILanguage = &H1 ' language id
liILDate = &H22 ' long date format ordering
liILZero = &H12 ' leading zeros for decimal
liIMeasure = &HD ' 0 = metric, 1 = US
liIMonLZero = &H27 ' leading zeros in month field
liINegCurr = &H1C ' negative currency mode
liINegSepBySpace = &H57 ' mon sym sep by space from neg amt
liINegSignPosN = &H53 ' negative sign position
liINegSymPrecedes = &H56 ' mon sym precedes neg amt
liIPosSepBySpace = &H55 ' mon sym sep by space from pos amt
liIPosSignPosN = &H52 ' positive sign position
liIPosSymPrecedes = &H54 ' mon sym precedes pos amt
liITime = &H23 ' time format specifier
liITLZero = &H25 ' leading zeros in time field
liNoUserOverride = &H80000000 ' do not use user overrides
liS1159 = &H28 ' AM designator
liS2359 = &H29 ' PM designator
liSAbbrevCtryName = &H7 ' abbreviated country name
liSAbbrevDayName1 = &H31 ' abbreviated name for Monday
liSAbbrevDayName2 = &H32 ' abbreviated name for Tuesday
liSAbbrevDayName3 = &H33 ' abbreviated name for Wednesday
liSAbbrevDayName4 = &H34 ' abbreviated name for Thursday
liSAbbrevDayName5 = &H35 ' abbreviated name for Friday
liSAbbrevDayName6 = &H36 ' abbreviated name for Saturday
liSAbbrevDayName7 = &H37 ' abbreviated name for Sunday
liSAbbrevLangName = &H3 ' abbreviated language name
liSAbbrevMonthName1 = &H44 ' abbreviated name for January
liSAbbrevMonthName2 = &H45 ' abbreviated name for February
liSAbbrevMonthName3 = &H46 ' abbreviated name for March
liSAbbrevMonthName4 = &H47 ' abbreviated name for April
liSAbbrevMonthName5 = &H48 ' abbreviated name for May
liSAbbrevMonthName6 = &H49 ' abbreviated name for June
liSAbbrevMonthName7 = &H4A ' abbreviated name for July
liSAbbrevMonthName8 = &H4B ' abbreviated name for August
liSAbbrevMonthName9 = &H4C ' abbreviated name for September
liSAbbrevMonthName10 = &H4D ' abbreviated name for October
liSAbbrevMonthName11 = &H4E ' abbreviated name for November
liSAbbrevMonthName12 = &H4F ' abbreviated name for December
liSAbbrevMonthName13 = &H100F
liSCountry = &H6 ' localized name of country
liSCurrenct = &H14 ' local monetary symbol
liSDate = &H1D ' date separator
liSDayName1 = &H2A ' long name for Monday
liSDayName2 = &H2B ' long name for Tuesday
liSDayName3 = &H2C ' long name for Wednesday
liSDayName4 = &H2D ' long name for Thursday
liSDayName5 = &H2E ' long name for Friday
liSDayName6 = &H2F ' long name for Saturday
liSDayName7 = &H30 ' long name for Sunday
liSDecimal = &HE ' decimal separator
liSEngCountry = &H1002 ' English name of country
liSEngLanguage = &H1001 ' English name of language
liSGrouping = &H10 ' digit grouping
liSIntlSymbol = &H15 ' intl monetary symbol
liSLanguage = &H2 ' localized name of language
liSList = &HC ' list item separator
liSLongDate = &H20 ' long date format string
liSMonDecimalSep = &H16 ' monetary decimal separator
liSMonGrouping = &H18 ' monetary grouping
liSMonthName1 = &H38 ' long name for January
liSMonthName2 = &H39 ' long name for February
liSMonthName3 = &H3A ' long name for March
liSMonthName4 = &H3B ' long name for April
liSMonthName5 = &H3C ' long name for May
liSMonthName6 = &H3D ' long name for June
liSMonthName7 = &H3E ' long name for July
liSMonthName8 = &H3F ' long name for August
liSMonthName9 = &H40 ' long name for September
liSMonthName10 = &H41 ' long name for October
liSMonthName11 = &H42 ' long name for November
liSMonthName12 = &H43 ' long name for December
liSMonThousandSep = &H17 ' monetary thousand separator
liSNativeCtryName = &H8 ' native name of country
liSNativeDigits = &H13 ' native ascii 0-9
liSNativeLangName = &H4 ' native name of language
liSNegativeSign = &H51 ' negative sign
liSPositiveSign = &H50 ' positive sign
liSShortDate = &H1F ' short date format string
liSThousand = &HF ' thousand separator
liSTime = &H1E ' time separator
liSTimeFormat = &H1003 ' time format string
End Enum
Private Declare Function GetLocaleInfo Lib "kernel32" _
Alias "GetLocaleInfoA" ( _
ByVal Locale As Long, _
ByVal LCType As LocaleInfoConstants, _
ByVal lpLCData As String, _
ByVal cchData As Long) _
As Long
Private Declare Function GetUserDefaultLCID Lib "kernel32" () As Long
Private Declare Function GetSystemDefaultLCID Lib "kernel32" () As Long
...
Public Function LocaleInfo(ByVal LocaleType As LocaleInfoConstants, Optional ByVal UserLocale As Boolean = True) As String
Dim L As Long, B As String * 1024, BL As Long
If UserLocale Then
L = GetUserDefaultLCID()
Else
L = GetSystemDefaultLCID()
End If
BL = GetLocaleInfo(L, LocaleType, B, Len(B))
LocaleInfo = Left$(B, BL - 1)
End Function
CjVirys писал(а):я тоже, вот уж не ожидал что так легко......
alibek писал(а):Я даже дополнюКонечно это все можно найти в MSDN, но моим вариантом удобнее пользоваться
...
Сейчас этот форум просматривают: Majestic-12 [Bot], SemrushBot и гости: 13