Студентка писал(а):у меня на форме 2 текстбокса.
в 1 -м появляется значение 0.353434
мне нужно чтобы во втором это значение было целое т.е. 35
как это сделать, подскажите пожалуйста
Text2.Text = Round(Val(Text1.Text) * 100, 0)
Dim num As Double
num = 0.353434
Text1.Text = num
num = Round(num, 2)
num = Mid(num, 3)
Text2.Text = num
Dim num As String
num = Round(Val(Text1.Text), 2)
num = Mid(num, InStr(1, num, ",") + 1)
Text2.Text = num
Option Explicit
Dim MyNeuron As clsNeuron
Private Sub Command1_Click()
Dim num As String
Set MyNeuron = New clsNeuron
With MyNeuron
.Synapses = 2
.Synapse(1) = 0.01
.Synapse(2) = 0.01
.Weight(1) = HScroll1.Value
.Weight(2) = -0.3
Text2.Text = .Value
num = Round(Val(Text2.Text), 2)
num = Mid(num, InStr(1, num, ",") + 1)
Text3.Text = num
End With
HScroll1.Value = 25
End Sub
Private Sub Form_Load()
HScroll1.Min = 25
HScroll1.Max = 100
End Sub
Private Sub HScroll1_Change()
Text1.Text = HScroll1.Value
End Sub
Private Sub HScroll1_Scroll()
Text1.Text = HScroll1.Value
End Sub
Option Explicit
Private mvarSynapses() As Double
Private mvarWeights() As Double
Private mvarSynapsesNum As Long
Public Property Let Synapses(ByVal NewVal As Long)
If NewVal > 0 Then
ReDim Preserve mvarSynapses(1 To NewVal)
ReDim Preserve mvarWeights(1 To NewVal)
mvarSynapsesNum = NewVal
End If
End Property
Public Property Get Synapses() As Long
Synapses = mvarSynapsesNum
End Property
Public Property Get Synapse(ByVal Index As Long) As Double
If Index >= 0 And Index <= mvarSynapsesNum Then
Synapse = mvarSynapses(Index)
End If
End Property
Public Property Let Synapse(ByVal Index As Long, ByVal NewVal As Double)
If Index >= 0 And Index <= mvarSynapsesNum Then
mvarSynapses(Index) = NewVal
End If
End Property
Public Property Get Weight(ByVal Index As Long) As Double
If Index >= 0 And Index <= mvarSynapsesNum Then
Weight = mvarWeights(Index)
End If
End Property
Public Property Let Weight(ByVal Index As Long, ByVal NewVal As Double)
If Index >= 0 And Index <= mvarSynapsesNum Then
mvarWeights(Index) = NewVal
End If
End Property
Public Property Get Value() As Double
Dim s As Double
Dim i As Long
s = 0
For i = 1 To mvarSynapsesNum
s = s + mvarSynapses(i) * mvarWeights(i)
Next i
Value = Activation(s)
End Property
Private Function Activation(ByVal NET As Double)
Activation = 1 / (1 + Exp(-NET))
End Function
Private Sub Class_Initialize()
mvarSynapsesNum = 1
ReDim mvarSynapses(1 To 1)
ReDim mvarWeights(1 To 1)
End Sub
Text5.Text = str$(CInt(Val(Text1.Text)*100))
Text5.Text = str$(CInt(.Value*100))
Text5.Text = str$(CInt(Val(Text1.Text)*100))
Private Sub Text5_Change()
Text5.Text = text1.Text * 100
End Sub
Text5.Text = text1.Text * 100
Text5.Text = text1.Text * 100
Text5.Text = text1.Text * 100
str1 = "риск инвестиций оценен как с редний с вероятностью" & Round(CDbl(text1.Text) * 100, 0) & " % . результат внесен в отчет"
MsgBox str1
Студентка писал(а):Amed
А как это сделать? как применить к числу fix или int?
Fix(23.154332) ' на выходе получаем 23
Int(23.154332) ' на выходе получаем 23
Сейчас этот форум просматривают: Google-бот, SemrushBot, Yandex-бот и гости: 25