Welcome to Emulationworld

Forum Index | FAQ | New User | Login | Search

Make a New PostPrevious ThreadView All ThreadsNext ThreadShow in Flat Mode*


SubjectRe: Visual Basic help, anyone ? Reply to this message
Posted byMarv
Posted on07/13/06 04:57 AM



> > > Ok, i am having a problem, the thing is, my code is only going so far, and
> > when
> > > it hit the line marked with **** it simple doesnt test it.
> > > Is there some limit for it ?
> > > or have i reached some kind of variable limit ?
> > >
> > > the program itself is quite big, and that if, was one of the first things,
> and
> > > it was working back when i coded it, i extensively tested it.
> > > its a search form through a database. its for a real estate control program
> i
> > am
> > > coding.
> > >
> > > code is as follows
> > > In reply to:
> > > If Problema12.ListIndex 0 And Problema22.ListIndex 0 And
> urgencia2.ListIndex
> > =
> > > 0 And cmb_valor2.ListIndex = 0 Then
> > > 'Label51.Caption = "teste"
> > > posicao = dBase.FindText(Problema12.List(Problema12.ListIndex), inicio, 2)
> > > If posicao = -1 Then Exit Sub
> > > If posicao -1 Then
> > > 'inicio2 = posicao
> > > dBase.AbsolutePosition = posicao
> > > achou = dBase.Field(3)
> > > Label1.Caption = achou
> > > Label2.Caption = Problema22.List(Problema22.ListIndex)
> > > Label51.Caption = achou
> > > Label52.Caption = Label2.Caption
> > >
> > > ***** If Label1.Caption = Label2.Caption Then
> > > List12.AddItem posicao, 0
> > > dBase.AbsolutePosition = posicao
> > > mostrartipo = dBase.Field(2)
> > > List2.AddItem mostrartipo, 0
> > > mostrardorm = dBase.Field(8)
> > > List3.AddItem mostrardorm, 0
> > > mostrarend = dBase.Field(0)
> > > List4.AddItem mostrarend, 0
> > > mostrarvalor = dBase.Field(13)
> > > List5.AddItem mostrarvalor, 0
> > > mostrarcontato = dBase.Field(11)
> > > List6.AddItem mostrarcontato, 0
> > > temfoto = dBase.Field(15)
> > > 'temfoto2 = Left(temfoto, 1)
> > > List13.AddItem temfoto, 0
> > > Label52.Caption = posicao
> > > MsgBox "não falhou"
> > > 'If temfoto2 "" Then
> > > ' List13.AddItem "S", 0
> > > ' GoTo temfoto1
> > > 'End If
> > > 'List13.AddItem "N", 0
> > > 'temfoto1:
> > > ***** End If
> > > posicao = posicao + 1
> > > inicio = posicao
> > > achou = " "
> > >
> > > End If
> > > End If
> > > The part between the **** is not being tested.
> > > and i am using label51 and label52 to check, and the values DO match, and
> so,
> > > the code should be doing the stuff between the **** lines.
> > >
> > > Any ideas ?
> > >
> >
> > So what happens? Does it not get to that line, or does it always say that
> > Label1.Caption Label2.Caption?
> > If it says Label1.Caption Label2.Caption, try checking the lengths of both
> > strings, and then if that doesn't give a clue, get the ascii code of each
> > character to make sure there's not an extra carriage return/line feed.
> > Also, check that TypeName(Label1.Caption) = TypeName(Label2.Caption) in case
> > somehow one of them is a Variant...
> >
> > Post back if you need more info, and I'll check tomorrow...
>
> i have checked the lenght and the ascii codes, and they seem exactly the same to
> me.
> it is always saying that label1.caption label2.caption.
> i will give the code a few more reads.
> Maybe i can see something that i'm missing.
> i will also check typename for both labels.
>
> i will post back when/if i find anything out.

OK. Another possibility is that although you've set the values of the label captions, the form hasn't updated them by the time it gets to that If (but when you try debugging, it's caught up, so it looks like they match) - you could try messing about using temporary string variables...



Dim label1Caption as String
Dim label2Caption as String
label1Caption = Label1.Caption
label2Caption = Label2.Caption
If label1Caption = label2Caption Then...

Else
Msgbox "Label1: " & label1Caption & "Label2: " & label2Caption
Endif







-
Entire Thread
Subject  Posted byPosted On
*Visual Basic help, anyone ?  Ti-BOne07/12/06 11:10 AM
.*You defile my forum with Visual Basic!?  Snowball 207/12/06 09:11 PM
..*i was wondering how long it was gonna take.  Ti-BOne07/13/06 08:23 AM
...*I'm biased  Snowball 207/13/06 08:56 AM
....*Yar  Marv07/13/06 09:05 AM
..*There's also a "Goto" in there ;o) -nt-  Marv07/13/06 01:45 AM
.*Re: Visual Basic help, anyone ?  Marv07/12/06 06:12 PM
..*Re: Visual Basic help, anyone ?  Ti-BOne07/12/06 07:09 PM
....Re: Visual Basic help, anyone ?  Marv07/13/06 04:57 AM
.*Re: Visual Basic help, anyone ?  arucard07/12/06 11:22 AM
..*Re: Visual Basic help, anyone ?  Ti-BOne07/12/06 01:33 PM