Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > calling window problem...! Help!


Reply
 
Thread Tools Display Modes
  #1  
Old 01-23-2004, 01:40 PM
kyle_baker kyle_baker is offline
Centurion
 
Join Date: Jan 2004
Posts: 106
Default calling window problem...! Help!


hey, i am creating a chat program, and i have programmed my program so that when you double click on an online user, it while on an im window by setting IMWindow1 = new IMWindow so it will open multiple times with the same form, now this is working fine, but when the user recieves a message i cannot find a way to direct the incoming message to the text box located on the right im window. I have also created a form that contains a listbox and everytime an im is opened or closed it is added or removed from the list, this is for me the be able to make my program keep track of the imwindows and not open multiples of the same users.

the code for when the user opens an im to a person themselves is...

Code:
Private Sub tContacts_DblClick() Dim sContact As Integer Dim IMWindow1 As IMWindow Dim i As Integer sContact = tContacts.SelectedItem.Index For i = 0 To CurrentIMWindows.List.ListCount - 1 If CurrentIMWindows.List.List(i) = tContacts.Nodes.Item(sContact) Then Exit Sub End If Next i Set IMWindow1 = New IMWindow CurrentIMWindows.List.AddItem (tContacts.Nodes.Item(sContact)) IMWindow1.Visible = True IMWindow1.Caption = tContacts.Nodes.Item(sContact) IMWindow1.Contact.Caption = tContacts.Nodes.Item(sContact) End Sub

so... what i need to be able to do is use the following code when text is recieved and make it react like...

Code:
Dim i As Integer Dim strSourceUser As String strSourceUser = strIncomingUser.Text For i = 0 To CurrentIMWindows.List.ListCount - 1 If CurrentIMWindows.List.List(i) = strSourceUser Then 'Here is where i need the code to say '(IMWindow1 Matching Criteria).Visible = true '(IMWindow1 Matching Criteria).txtMsgLog.Text = (IMWindow1 Matching Criteria).txtMsgLog & ": " & strMessage End If Next i

...thats what i need, and i know some one can do it cause i've asked some questions i thought were impossible and then someone gives a really simple peice of code that i knew but didn't think about, so thanks in advance for your help!
Reply With Quote
  #2  
Old 01-23-2004, 01:47 PM
Iceplug's Avatar
Iceplug Iceplug is offline
MetaCenturion

Retired Moderator
* Guru *
 
Join Date: Aug 2001
Location: California, USA
Posts: 16,583
Default

You'll probably want to make a Collection.
In this collection, you can store references to a form, and supply a key so that you can reference a form by a string property.
You can define the collection in a module...
then, when you want to make a new form.
Code:
Dim NewForm As IMWindowForm Set NewForm = New IMWindowForm IMCollection.Add NewForm, UserOnThisForm 'Then do what you want with the form
__________________

Iceplug, USN
Quadrill 1 Quadrill 2 (full) Quadrill 3 JumpCross .NET Website is ALIVE! - DL Platform Tour for VB.NET! Posting Guidelines Hint: Specify your location in your user cp profile if you want compassion!
Reply With Quote
  #3  
Old 01-23-2004, 01:58 PM
kyle_baker kyle_baker is offline
Centurion
 
Join Date: Jan 2004
Posts: 106
Default

Quote:
Originally Posted by Iceplug
You'll probably want to make a Collection.
In this collection, you can store references to a form, and supply a key so that you can reference a form by a string property.
You can define the collection in a module...
then, when you want to make a new form.
Code:
Dim NewForm As IMWindowForm Set NewForm = New IMWindowForm IMCollection.Add NewForm, UserOnThisForm 'Then do what you want with the form



hey, if i have Set IMWindow1 = New IMWindow already then what i'm asking is how can how can i address the newly opened form with out using IMWindow1.blah because that would effect all of the forms created as new imwindows wouldn't it? i can already identify which form has the incoming users name on it as the caption, but i need to be able to address it and change the text on it only, please give coding examples, they help me understand, thanks for your help.
Reply With Quote
  #4  
Old 01-23-2004, 02:15 PM
Iceplug's Avatar
Iceplug Iceplug is offline
MetaCenturion

Retired Moderator
* Guru *
 
Join Date: Aug 2001
Location: California, USA
Posts: 16,583
Default

Oh...
to access a window that you've added to the IMCollection, you'd do something like this...
Code:
Dim CurrentForm As IMWindowForm Set CurrentForm = IMCollection(SomeUserName) CurrentForm.ZOrder 0 'ZOrder just moves it to the front.
So, you can just change the properties on the form by using the CurrentForm variable

Also, if you use IMWindow1.blah, it should only affect that instance of IMWindow1.
If you used IMWindow, nothing happens since you are creating instances.
The only way to affect all of the forms would be with a loop.
__________________

Iceplug, USN
Quadrill 1 Quadrill 2 (full) Quadrill 3 JumpCross .NET Website is ALIVE! - DL Platform Tour for VB.NET! Posting Guidelines Hint: Specify your location in your user cp profile if you want compassion!
Reply With Quote
  #5  
Old 01-23-2004, 03:43 PM
kyle_baker kyle_baker is offline
Centurion
 
Join Date: Jan 2004
Posts: 106
Default

Quote:
Originally Posted by Iceplug
Oh...
to access a window that you've added to the IMCollection, you'd do something like this...
Code:
Dim CurrentForm As IMWindowForm Set CurrentForm = IMCollection(SomeUserName) CurrentForm.ZOrder 0 'ZOrder just moves it to the front.
So, you can just change the properties on the form by using the CurrentForm variable

Also, if you use IMWindow1.blah, it should only affect that instance of IMWindow1.
If you used IMWindow, nothing happens since you are creating instances.
The only way to affect all of the forms would be with a loop.



i have one morequestion, is there anyway that i can substitue the variable IMWindow1 with the users user name and then i could just tell it to for instance do this... (user name).setfocus
Reply With Quote
  #6  
Old 01-23-2004, 05:09 PM
kyle_baker kyle_baker is offline
Centurion
 
Join Date: Jan 2004
Posts: 106
Question help!

does that current form this only work with the form that is on top or what? cause if i have like 3 forms open that are IMWindow1 windows how will it work? i'm not understanding how to addthis to my code. thanks in advanced!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Constant Values For Window Display SkreeM General 5 10-20-2003 05:06 AM
Calling another window DigsterX API 1 09-24-2003 07:58 AM
Subclassing as a Method of Problem Solving John Tutors' Corner 1 05-12-2003 09:32 PM
Window list problem cheng_sh General 3 08-16-2002 10:47 AM
Help Me...GURU Luckyboy General 10 10-22-2001 08:08 PM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->