my groupmates and i are making a project which are very ifficult for a begginer.
in our project, we have some of the codes.
the problem is when we run-start it....
and click the command button (which are factorial and fibonacci)
the answers will not appear to the result text/label...
can u help us...
so that the answers will be listed to the result text/label???
hope you can answer us as soon as possible...
thanx and more powers to this site...
hope you can help more people like us about this programming...
this project challenge us to pursue and make these project....
thanx a lot!!!

Recommended Answers

All 4 Replies

It's not so clear what you're asking. Are you asking how to print the result into a label? then do the following.
Label1.caption = result
If it's something else you need, try to rephrase the question or send your code

commented: nice and concise help efforts...thanks +0

Hi,

Must be Problem with the Code. Post ur Code here, we can help u...

Regards
Veena

i got already the fibonacci!! what is wrong with this code????
Private Sub cmdFindPrime_Click()
Dim is_prime() As Boolean
Dim max_number As Long
Dim i, j As Long
Dim txt As String

Screen.MousePointer = vbHourglass
'create the array'
max_number = CLng(txtInput.Text)
ReDim is_prime(2 To max_number)
For i = 2 To max_number
is_prime(i) = True
Next i

For i = 2 To max_number / 2
If is_prime(i) Then
'cross out all the numbers that are multiples of this number.'
For j = 2 To max_number / i
is_prime(j + i) = False
Next j
End If
Next i
'display the primes'
j = 0
For i = 2 To max_number
If is_prime(i) Then
txt = txt & Format(i)
j = j + 1
If (j Mod 5) = 0 Then
txt = txt & vbCrLf
Next i

End If

txtInput.Text = txt
Screen.MousePointer = vbDefault
End If
End Sub

thanx a lot and more powers

try this code to see if number is prime
Private Sub Command1_Click()
mynumber = txtinputext
if mynumber = 1 then isprime = false
For i = 2 To mynumber - 1
If mynumber Mod i = 0 Then
isprime = False
'Get out as soon as we know it's not prime
Exit Sub
End If
Next
isprime = true
End Sub

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.