• Welcome to Valhalla Legends Archive.
 

How do you do this?

Started by BaDDBLooD, June 27, 2004, 01:20 PM

Previous topic - Next topic

BaDDBLooD

I have AddChat on my Main Form

Than in a Class Module

i want to use addchat

So i do



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



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.



   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



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 )
There are only two kinds of people who are really fascinating: people who know absolutely everything, and people who know absolutely nothing.

ChR0NiC

Quote from: BaDDBLooD on June 27, 2004, 01:20 PM
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 )

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.

warz

I wouldnt tell you that. I'm a fan of learning from examples. Books don't do it for me.

BaDDBLooD

Same here warz =)

Anyone got any help?
There are only two kinds of people who are really fascinating: people who know absolutely everything, and people who know absolutely nothing.

MyndFyre

Quote from: warz on June 27, 2004, 03:56 PM
I wouldnt tell you that. I'm a fan of learning from examples. Books don't do it for me.

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.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

BaDDBLooD

Quote from: Myndfyre on June 27, 2004, 07:49 PM
Quote from: warz on June 27, 2004, 03:56 PM
I wouldnt tell you that. I'm a fan of learning from examples. Books don't do it for me.

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.

Got any advice on how to do this MyndFyre? I been looking over Google.. but have found nothing on how to fix my problem.
There are only two kinds of people who are really fascinating: people who know absolutely everything, and people who know absolutely nothing.

MyndFyre

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.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

BaDDBLooD

There are only two kinds of people who are really fascinating: people who know absolutely everything, and people who know absolutely nothing.

MyndFyre

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:


Sub DoSomething(ByVal fm As frmMain)

End Sub


And within that function, you can do


fm.AddChat( argument-list )
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.