Valhalla Legends Forums Archive | .NET Platform | How do you do this?

AuthorMessageTime
BaDDBLooD
I have AddChat on my Main Form

Than in a Class Module

i want to use addchat

So i do

[code]

frmMain.AddChat(rtbChat, Color.Yellow, "BNLS: Sending Authorization")

[/code]

It says name "rtbChat" is not declared

As a test i did

frmMain.rtbChat instead of rtbChat, and than frmMain.AddChat got the same error.

Note: The Addchat works if i use it on the same form it's located.

[code]

Public Function AddChat(ByVal RichTextBox As RichTextBox, ByVal ParamArray Text() As Object) As Object

With RichTextBox
.SelectionStart = 99999999
.SelectionLength = 0
.SelectionColor = Color.White
.SelectedText = "[" & TimeOfDay & "] "
.SelectionStart = 99999999
End With

For I As Integer = Text.GetLowerBound(0) To Text.GetUpperBound(0) Step 2

With RichTextBox
.SelectionStart = 99999999
.SelectionLength = 0
.SelectionColor = Text(I)
.SelectedText = Text(I + 1) & Microsoft.VisualBasic.Left(vbCrLf, -2 * CLng((I + 1) = UBound(Text)))
.SelectionStart = 99999999
End With

Next

End Function

[/code]

Bare with me.. I am still learning .NET and i don't have a Good Book, and haven't found a really nice tutorial site for vb.net ( yet )
June 27, 2004, 6:20 PM
ChR0NiC
[quote author=BaDDBLooD link=board=37;threadid=7466;start=0#msg67428 date=1088360437]
Bare with me.. I am still learning .NET and i don't have a Good Book, and haven't found a really nice tutorial site for vb.net ( yet )
[/quote]

No offense, but any good bot writer will tell you to learn the language before attempting to make a bot. This instance is no different.
June 27, 2004, 8:52 PM
warz
I wouldnt tell you that. I'm a fan of learning from examples. Books don't do it for me.
June 27, 2004, 8:56 PM
BaDDBLooD
Same here warz =)

Anyone got any help?
June 27, 2004, 8:57 PM
Myndfyr
[quote author=warz link=board=37;threadid=7466;start=0#msg67458 date=1088369776]
I wouldnt tell you that. I'm a fan of learning from examples. Books don't do it for me.
[/quote]

Then learn by examples, don't learn by code. The .NET Framework SDK Documentation has more samples than the number of men your momma has slept with. (Cheesy, I know). So look at the samples. This isn't time for us to do for you.
June 28, 2004, 12:49 AM
BaDDBLooD
[quote author=Myndfyre link=board=37;threadid=7466;start=0#msg67498 date=1088383746]
[quote author=warz link=board=37;threadid=7466;start=0#msg67458 date=1088369776]
I wouldnt tell you that. I'm a fan of learning from examples. Books don't do it for me.
[/quote]

Then learn by examples, don't learn by code. The .NET Framework SDK Documentation has more samples than the number of men your momma has slept with. (Cheesy, I know). So look at the samples. This isn't time for us to do for you.
[/quote]

Got any advice on how to do this MyndFyre? I been looking over Google.. but have found nothing on how to fix my problem.
June 28, 2004, 2:08 AM
Myndfyr
What I would suggest is this....

The RichTextBox rtbChat belongs to an instance of frmMain. If all the work you're doing is on frmMain, then from within frmMain, all you have to do is AddChat(ByVal ParamArray data() As Object). You don't need to use ByVal rtbChat As RichTextBox. Why? Because the AddChat function already knows what RTB to add to -- the one on its form.
June 28, 2004, 6:19 AM
BaDDBLooD
i have 2 ;\
June 28, 2004, 4:13 PM
Myndfyr
By the way, you don't use frmMain.AddChat unless frmMain is static (which it is not, it's instance). You have an INSTANCE of frmMain, such as:

[code]
Sub DoSomething(ByVal fm As frmMain)

End Sub
[/code]

And within that function, you can do

[code]
fm.AddChat( argument-list )
[/code]
June 28, 2004, 5:25 PM

Search