Welcome to Dream.In.Code
Become a VB Expert!

Join 149,551 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,583 people online right now. Registration is fast and FREE... Join Now!




My Vb seems to be screwed up.. or im just noob

 
Reply to this topicStart new topic

My Vb seems to be screwed up.. or im just noob

oXiDe
17 Nov, 2007 - 06:35 PM
Post #1

New D.I.C Head
*

Joined: 17 Nov, 2007
Posts: 37



Thanked: 1 times
My Contributions
Sup im kinda new to vb & i think my vb is jacked up sad.gif

Very randomly whenever i do something like txtSomeText.Text = "Hello" or cmdSomeCommand.Caption = "Click me!" and run it ill get an error like "Compile Error: Method or DataMember not found" and the .Text or .Caption will be highlighted.

Heres the code to a calculator project i made a while back. I know the code is crap and wont work, but i shouldnt be getting that compile error thing.

CODE
Option Explicit
    Dim Value1 As Double
    Dim Value2 As Double
    Dim Value3 As Double

Private Sub cmdAdd_Click(Index As Integer)

    Value3 = Value1 + Value2
    
End Sub

Private Sub Form_Load()

    txtV1.Text = Value1
    txtV2.Text = Value2
    txtOutput.Text = Value3
    
End Sub


http://www.sendspace.com/file/9q3zdl = Link to full source to see what i mean when i do run sad.gif

The calculator project is just an example.. Just earlier today i was half way done w/ a CSS Generator i was making to edit myspace profiles & i got same error & now i dont believe i will be able to finish sad.gif.
User is offlineProfile CardPM
+Quote Post

born2c0de
RE: My Vb Seems To Be Screwed Up.. Or Im Just Noob
17 Nov, 2007 - 11:35 PM
Post #2

printf("I'm a %XR",195936478);
Group Icon

Joined: 26 Nov, 2004
Posts: 4,026



Thanked: 38 times
Dream Kudos: 2800
Expert In: 80x86 Assembly, C/C++, VB6, VB.NET, C#, J2SE, Win32 API, Reversing

My Contributions
Try converting the RHS expression into a string and see if it works:
CODE
txtV1.Text = Str(Value1)

User is offlineProfile CardPM
+Quote Post

oXiDe
RE: My Vb Seems To Be Screwed Up.. Or Im Just Noob
18 Nov, 2007 - 09:11 AM
Post #3

New D.I.C Head
*

Joined: 17 Nov, 2007
Posts: 37



Thanked: 1 times
My Contributions
thanks ill use that as a backup idea.. there is something wrong w/ my vb but if you guys could maybe just post alternatives to doing txtSomeText = "Some Text" that would be greatly appreciated. this is one my friend gave me. it puts on a timestamp but i can take it off.

CODE
Public Sub AddC(RTB As RichTextBox, ParamArray saElements() As Variant)
With RTB
    RTBName = .Name
End With
    Dim i As Integer
        With RTB
        .SelStart = 999999999
        .SelLength = 0
        .SelColor = &HE0E0E0
        .SelText = "[" & Format(Time, "hh:mm:ss") & "] "
        .SelStart = 999999999
        End With
    For i = LBound(saElements) To UBound(saElements) Step 2
        With RTB
        .SelStart = 999999999
        .SelLength = 0
        .SelColor = saElements(i)
        .SelText = saElements(i + 1) & Left$(vbCrLf, -2 * CLng((i + 1) = UBound(saElements)))
        .SelStart = 999999999
        End With
    Next i
With RTB
If Len(.Text) >= 10000 Then
.SelStart = 0
.SelLength = 10000
.SelText = ""
.SelLength = 10000
.SelStart = Len(.Text)
End If
If Len(.Text) >= 5000 Then
.SelStart = 0
.SelLength = 2500
.SelText = ""
.SelLength = 5000
.SelStart = Len(.Text)
End If
.Refresh
End With
End Sub

User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: My Vb Seems To Be Screwed Up.. Or Im Just Noob
18 Nov, 2007 - 10:22 AM
Post #4

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 9,482



Thanked: 161 times
Dream Kudos: 9050
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
Somehow you ended up with a control array, so when you had V1.Text that control doesn't exist. I downloaded your code and looked at it and thats how I found this. This code, however, works:

CODE

Option Explicit
    Dim Value1 As Double
    Dim Value2 As Double
    Dim Value3 As Double

Private Sub Add_Click(Index As Integer)
    Value3 = Value1 + Value2
End Sub

Private Sub Form_Load()
    V1(0).Text = Value1
    V2(1).Text = Value2
    Output.Text = Value3
End Sub


Control V1 has an index or zero, and control V2 has an index of 1. So add this code to your control and it will run just fine smile.gif
User is online!Profile CardPM
+Quote Post

oXiDe
RE: My Vb Seems To Be Screwed Up.. Or Im Just Noob
20 Nov, 2007 - 04:20 PM
Post #5

New D.I.C Head
*

Joined: 17 Nov, 2007
Posts: 37



Thanked: 1 times
My Contributions
dude .. omg .. wow.... thx so much
i started studying c++ cause i thought vb wouldnt ever work but C++ is too complicated.. i was so sad until now biggrin.gif
PhsycoCoder FTW
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/7/09 09:47PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month