Loading

How to make looping statement in vb

18 posts / 0 new
Last post
Lynesus's picture
Offline
Joined: 01/25/2010
How to make looping statement in vb

hi guyz specially to admin can you ,help me about my problem in looping i cant make it

Lynesus's picture
Offline
Joined: 01/25/2010
looping problem

hi can u help me in looping statement

=>> jhaye.info <<==

Anonymous
re:

example of for loop

dim i as integer
for i=1 to listview.columnheaders.count
combobox.additem listview.columnheaders(i).text
next i

this code will add the text in each columnheader of the listview control in the combobox. this is for search tool of your projects..
tnx

leomar ramos

Lynesus's picture
Offline
Joined: 01/25/2010
re

ok tnx i'll try to make your suggestion

=>> jhaye.info <<==

cidfrey's picture
Offline
Joined: 12/17/2009
Use For for the start of

Use For for the start of looping and Next for the back end.

Don't have much idea about sa gusto mo magyari kse ndi ka naman nagpost ng codes kung san ilalagay ung loop

Web / System Developer
Contacts :
09327081978
recca_flame05@yahoo.com >>> Facebook/YM
ICCT Colleges Cainta Rizal

Lynesus's picture
Offline
Joined: 01/25/2010
help me!!asap

hi guys will u help me about looping statement in my thesis. I think it has an error because the code is not functioning will you help me to debug the error?

here's my code...

Private Sub cmdenter_Click()
Call Entry

Set DataGrid1.DataSource = rs
If lblscreen(0).Caption = "" Then
MsgBox "Enter your ID Number first.", vbCritical, "System Security"
Else
If Not rs.BOF Then
rs.MoveFirst
End If
Do Until rs.EOF = True
If lblscreen(0) <> rs!stud_id Then
Exit Do
Else
With studinfo2
.Show
.lblIDno = rs!stud_id
.lblname = rs!full_name
.lblage = rs!age
.Label6(0) = rs!gender
.Label7 = rs!address
.Label8 = rs!year_level
.Label9 = rs!course
.Label10 = rs!c_major
End With
Unload Me
Exit Do
End If
Loop
End If
End Sub

Public Sub Entry()
Set rs = New ADODB.Recordset
rs.Open "Select * from sa03_user_01 where stud_id like '" & LogMeIn.lblscreen(0).Caption & "'", cn, adOpenKeyset, adLockPessimistic
End Sub

Public Sub myCon()
Dim mDataSource As String

mDataSource = "database/kiosk.mdb"
Set cn = New ADODB.Connection

cn.CursorLocation = adUseClient
cn.CommandTimeout = 0
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & mDataSource & ";Persist Security Info=False"

Set rs = New ADODB.Recordset
End Sub

help me please..tnx,,godbless

=>> jhaye.info <<==

Anonymous
hi!

can you tell me what is the exact error?

Anonymous
Unload Me

i think its the error ->Unload Me
try to put that code before the end sub

jaysfall's picture
Offline
Joined: 01/20/2010
FOR LOOP :

The output will be in the c combobox
gaya neto"2009-2010"
Gingamit to sa Semester table hehe
ilagay mo to sa form load

Private Sub Form_Load()
Dim x
For x = 2010 To 2000 Step -1
Combo1.AddItem x & "-" & x + 1
Next x
End Sub

oh yan ..sana makatulong.hehe

Consultant / .Net Developer

::jayxceleste@ymail.com::

+639161514777

Lynesus's picture
Offline
Joined: 01/25/2010
re

hindi po kc ako pwede gumamit ng combo box sa project na ga2win ko...

designed for touchscreen sya and for viewing of informations only like kiosk terminal na maki2ta sa different universities...

tnx for your replies and suggestions

=>> jhaye.info <<==

Anonymous
hahaha..

ngee.kasi post mo lng eh f panu mg looping..so aun.haha
anu b gusto mo mngyari ah..?

Lynesus's picture
Offline
Joined: 01/25/2010
re

ganito kc un,,

ang login form q is like calculator pero numbers lng meron design kc sya for touchscreen like different information kiosk

I already finished the design of my project and the only problem is the looping statement

kung d nya makita yung match na user move xa sa next record hanggang makita nya ung user

=>> jhaye.info <<==

jaysfall's picture
Offline
Joined: 01/20/2010
re:

its like just youre comparing a sql statement dba.hehe
gnto siguru un..ah siguru ung mga numbers eh nka array po un..
so it means you will need a for loop..

example:
nakaaray po ung cmd jan
Private Sub Command1_Click(Index As Integer)
'Label2.Caption = ""
For x = 0 To 2 'so tatlo lng ung cmd x represent its index
If Command1(x).Value = True Then
Label2.Caption = Label2.Caption & Command1(x).Caption
End If
Next x
End Sub

rs.open"select * from table where username="& val( label2.caption) &"",con,2,3

if not rs.eof then
msgbox"sdfsdfsf"
else
msgbox"sdfsdf"
end if

hehe try mo!

Consultant / .Net Developer

::jayxceleste@ymail.com::

+639161514777

Anonymous
advice lang!!!

try mu kya i trap ung error...
gumamit k ng break point every line
dun mo mkkta if bakit d gumagana ung loop,
break point is good in case of debugging.

Lynesus's picture
Offline
Joined: 01/25/2010
re

yah,, you're right..

actually i've already solved that problem last night..

tnx to you guyz...

ipagpapatuloy q na paggawa ng thesis q,,if my problem prin i will post it here..

tnx again..

=>> jhaye.info <<==

Anonymous
hello!!! anyone help me please..

ask ko lng po bakit nagkakaron ng error na invalid null kapag nag-add na ako ng records ko sa na addform ko kapag binalikan ko ung ms-access ko meron na 1 na naka- blank kaya null na sy.. sa vb 6.0 po ha..

cidfrey's picture
Offline
Joined: 12/17/2009
Dude

Use Do Until tpos sa end nya lagay ka ng Loop =)

Web / System Developer
Contacts :
09327081978
recca_flame05@yahoo.com >>> Facebook/YM
ICCT Colleges Cainta Rizal

Lynesus's picture
Offline
Joined: 01/25/2010
re

tingnan mo ung database table mo then punta ka sa design view tingnan mo dun kung nakaset ang Required sa YES,,set mo yung Required=NO then Allow Zero Length=YES

=>> jhaye.info <<==

Pages

Add new comment

Filtered HTML

  • You may insert videos with [video:URL]
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <asp>, <c>, <cpp>, <csharp>, <css>, <html4strict>, <java>, <javascript>, <mysql>, <php>, <python>, <sql>, <vb>, <vbnet>. The supported tag styles are: <foo>, [foo].
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.