|
-
Mar 11th, 2008, 04:40 PM
#1
Thread Starter
Lively Member
Out of Stack space error sending list1 text to list2 text.
I seem to be running into a problem perhaps I should explain a little what im trying to do so I wont need to keep on making all theses topics.
Im trying to use Text1.Text to add to the list of names that are in List1 then I send all the names in list1 to list2 however im getting a Out of Stack space error
-
Mar 11th, 2008, 04:44 PM
#2
Re: Out of Stack space error sending list1 text to list2 text.
Without seeing your routine, we can't help much. That error generally means you have entered an infinite loop.
-
Mar 11th, 2008, 04:46 PM
#3
Thread Starter
Lively Member
Re: Out of Stack space error sending list1 text to list2 text.
let me see if I can clean up my form abit and I'll post what I got.
-
Mar 11th, 2008, 04:49 PM
#4
Thread Starter
Lively Member
Re: Out of Stack space error sending list1 text to list2 text.
Code:
Private Sub Command1_Click()
Dim imclass As Long
Dim yiminputwindow As Long
Dim x As Long, editx As Long
Dim Button As Long
On Error Resume Next
imclass = FindWindow("imclass", vbNullString)
PostMessage imclass, WM_COMMAND, 33134, 0
DoEvents
x = FindWindow("#32770", vbNullString)
editx = FindWindowEx(x, 0&, "Edit", vbNullString)
DoEvents
x = FindWindow("#32770", vbNullString)
Button = FindWindowEx(x, 0&, "button", "&Ignore User...")
Call SendMessageLong(Button, WM_KEYDOWN, VK_SPACE, 0&)
Call SendMessageLong(Button, WM_KEYUP, VK_SPACE, 0&)
Do
DoEvents
imclass = FindWindow("imclass", vbNullString)
yiminputwindow = FindWindowEx(imclass, 0&, "yiminputwindow", vbNullString)
Call SendMessageByString(yiminputwindow, WM_SETTEXT, 0&, List2.Text & " have been Ignored.")
Call SendMessageLong(yiminputwindow, WM_KEYDOWN, 13, 0&)
Loop Until yiminputwindow <> 0
End Sub
Private Sub Command2_Click()
cd1.FileName = ""
cd1.Filter = "Namelist (*.txt)|*.txt"
cd1.ShowSave
If cd1.FileName <> "" Then
Savenublist cd1.FileName, List1
End If
End Sub
Private Sub Command3_Click()
Loadtxt cd1, List1
End Sub
Private Sub Command4_Click()
Text1.Text = List1.Text
End Sub
Function Loadtxt(dialogCommon As CommonDialog, list45 As ListBox)
With dialogCommon
.DialogTitle = "Load Your Yahoo! Lamer List"
.Filter = "Lamers Namelist (*.txt)|*.txt"
.ShowOpen
Close #1
Open .FileName For Input As #1
While Not EOF(1)
Line Input #1, allstring
List1.AddItem allstring
Wend
Close #1
End With
End Function
Function Savenublist(thefilename As String, thelist As ListBox)
Open thefilename For Output As #1
For i = 0 To List1.ListCount - 1
Print #1, List1.List(i)
Next i
Close #1
End Function
Private Sub Form_Load()
End Sub
Private Sub List1_Click()
List1.Text = List2.Text
End Sub
is what I have Im basicly making a program to ignore a list of names within a list box and then display the names that I have ignored within list2.
The point of this program is for yahoo and this is my work around for syslistview heh, it basicly uses a list of names you can load and then save and use again later.
Feel free if there is anything I should currect to this to that might be a problem.
-
Mar 11th, 2008, 04:58 PM
#5
Re: Out of Stack space error sending list1 text to list2 text.
Hmmmm.
You are looking for windows but not checking if the return value is zero. Do that. If zero, then the window was not found & you should abort your routine.
Recommend not hardcoding file numbers, use VB's FreeFile() function to return one for you.
Your problem is the List1.Text=List2.Text. Each time you set a listbox item from code, it fires another Click event. Since you are setting it in the click event, you are entering an infinite loop until stack space or memory prevents it from going on and on and on and ....
-
Mar 11th, 2008, 05:01 PM
#6
Thread Starter
Lively Member
Re: Out of Stack space error sending list1 text to list2 text.
I dont think I follow is it possible to show me what your talking about maybe give me something to work with? Im not a genus with Visual Basic
-
Mar 11th, 2008, 06:16 PM
#7
Re: Out of Stack space error sending list1 text to list2 text.
 Originally Posted by BlackMagic
I dont think I follow is it possible to show me what your talking about maybe give me something to work with? Im not a genus with Visual Basic 
Yes, remove or fix this part:
Code:
Private Sub List1_Click()
List1.Text = List2.Text
End Sub
I doubt you want to click on a list1 item, then assign it to a list2 item. I think you might want the reverse action. It is not clear what your intentions are. Also, recommend not getting in the habit of assigning a listbox value by some .Text value. If the text doesn't exist in the listbox, then errors.
You have several posts that a very similar. Consider marking ones resolved that do not require any more feedback, so no one wastes their time answering questions that do not need to be answered. Thank you.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|