-
Jun 11th, 2022, 12:54 AM
#41
Thread Starter
PowerPoster
Re: About a single instance of a For Next loop
Thanks dudes, you were good help for me to get my single instance for ... next statement block, to be written right. This has been achieved and then now i am going to mark this thread, resolved, then so
I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...
|Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Event's Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Bar | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern |
Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...
-
Jun 11th, 2022, 12:35 PM
#42
Re: About a single instance of a For Next loop
 Originally Posted by ThEiMp
Thanks dudes, you were good help for me to get my single instance for ... next statement block, to be written right. This has been achieved and then now i am going to mark this thread, resolved, then so
Out of interest could you post your solution? I am intrigued to see how a single iteration loop would work when no loop at all wouldn't.
-
Jun 11th, 2022, 09:52 PM
#43
Thread Starter
PowerPoster
Re: [RESOLVED] About a single instance of a For Next loop
Okay then here it is, like so:
Code:
Option Explicit
'
Dim PauseTime, Start, Finish, TotalTime
Dim strBuff As String
Dim m_Marker As Byte
Dim OneTime As Boolean
Dim a As Integer
Dim b As Integer
'
Public Property Get Marker() As Byte
On Error Resume Next
m_Marker = m_Marker
End Property
Public Property Let Marker(ByVal New_Marker As Byte)
On Error Resume Next
m_Marker = New_Marker
PropertyChanged "Marker"
End Property
Private Sub UserControl_Initialize()
On Error Resume Next
1 If OneTime = False Then
For a = 1 To 1
b = 0
b = b + 1
PauseTime = 6
Start = Timer
Do While Timer < Start + PauseTime
DoEvents
Loop
Finish = Timer
TotalTime = Finish - Start
If TotalTime = 0 Then GoTo 2
2 strBuff = StrConv(LoadResData("EP" & b, "VIDEO"), vbUnicode)
Open "C:\Temp\zVideo-1234567890.mkv" For Output As #1
Print #1, strBuff
Close #1
PauseTime = 6
Start = Timer
Do While Timer < Start + PauseTime
DoEvents
Loop
Finish = Timer
TotalTime = Finish - Start
If TotalTime = 0 Then GoTo 3
3 If b = 11 Then m_Marker = "B"
strBuff = ""
OneTime = True
Next a
Else
Exit Sub
End If
End Sub
Private Sub UserControl_Resize()
On Error Resume Next
With UserControl
.Height = 330
.Width = 435
End With
End Sub
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
On Error Resume Next
With PropBag
m_Marker = .ReadProperty("Marker", "A")
End With
End Sub
Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
On Error Resume Next
With PropBag
Call .WriteProperty("Marker", m_Marker, "A")
End With
End Sub
I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...
|Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Event's Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Bar | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern |
Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...
-
Jun 12th, 2022, 04:52 AM
#44
Re: [RESOLVED] About a single instance of a For Next loop
Does that really work as intended? You have still left a lot of the issues in there that were previously pointed out to you...
just a few, I have added comments to the code itself
Code:
Option Explicit
'
Dim PauseTime, Start, Finish, TotalTime 'Did you mean to use variants?
Dim strBuff As String
Dim m_Marker As Byte
Dim OneTime As Boolean
Dim a As Integer
Dim b As Integer
'
Public Property Get Marker() As Byte
On Error Resume Next ' why? this is dangerous normally, pointless here
m_Marker = m_Marker 'This achieves nothing, a Get should return something as well.
End Property
Public Property Let Marker(ByVal New_Marker As Byte)
On Error Resume Next ' why? this is dangerous normally, pointless here
m_Marker = New_Marker
PropertyChanged "Marker"
End Property
Private Sub UserControl_Initialize()
On Error Resume Next 'This is going to hide any errors in this sub, probably not a good idea!
1 If OneTime = False Then 'Label 1 is never used anywhere, this is the only place OneTime is referred to and will always be false so no need for the If statement anyway
For a = 1 To 1 'How is this any different to not having a loop though?
b = 0
b = b + 1 'Why not just set b = 1, as this is never going to execute more than once
PauseTime = 6
Start = Timer
Do While Timer < Start + PauseTime
DoEvents
Loop 'Busy loops like this are normally a bad idea
Finish = Timer
TotalTime = Finish - Start
If TotalTime = 0 Then GoTo 2 'Does nothing, it would go to the next line anyway.
2 strBuff = StrConv(LoadResData("EP" & b, "VIDEO"), vbUnicode) 'Treating binary data as a string???
Open "C:\Temp\zVideo-1234567890.mkv" For Output As #1
Print #1, strBuff
Close #1
PauseTime = 6
Start = Timer
Do While Timer < Start + PauseTime
DoEvents
Loop 'Busy loop again
Finish = Timer
TotalTime = Finish - Start
If TotalTime = 0 Then GoTo 3 'Again does nothing as it would go to the next line anyway
3 If b = 11 Then m_Marker = "B" 'how will it ever be 11 if you start and 1 and only run the loop once? Also Marker is a byte, why are you assigning a string?
strBuff = ""
OneTime = True
Next a
Else
Exit Sub
End If
End Sub
Private Sub UserControl_Resize()
On Error Resume Next 'Hiding potential errors
With UserControl
.Height = 330
.Width = 435
End With
End Sub
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
On Error Resume Next 'Hiding potential errors
With PropBag
m_Marker = .ReadProperty("Marker", "A") 'm_Marker is a Byte, why assign a string / character?
End With
End Sub
Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
On Error Resume Next 'Hiding potential errors
With PropBag
Call .WriteProperty("Marker", m_Marker, "A")
End With
End Sub
There still seems to be a lot of potential problems, and I still don't see how a loop that runs only once by design makes any sense....
Last edited by PlausiblyDamp; Jun 12th, 2022 at 02:16 PM.
-
Jun 14th, 2022, 10:29 PM
#45
Thread Starter
PowerPoster
Re: [RESOLVED] About a single instance of a For Next loop
But then it works, right for the time being, then
I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...
|Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Event's Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Bar | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern |
Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...
-
Jun 15th, 2022, 07:11 AM
#46
Re: [RESOLVED] About a single instance of a For Next loop
So.
By the power invested in me, all the threads I start are Niya and Olaf free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.
-
Jun 15th, 2022, 07:29 AM
#47
Re: [RESOLVED] About a single instance of a For Next loop
 Originally Posted by ThEiMp
But then it works, right for the time being, then
You have a strange definition of "works" then. I dread to think how many subtle (or not subtle) bugs are lurking in that code.
-
Jun 15th, 2022, 10:29 AM
#48
Addicted Member
Re: [RESOLVED] About a single instance of a For Next loop
In cargo cult programming it is OK to have code that has no sense as long as the program works.
-
Jun 15th, 2022, 02:13 PM
#49
Re: [RESOLVED] About a single instance of a For Next loop
 Originally Posted by argen
In cargo cult programming it is OK to have code that has no sense as long as the program works.
Perhaps I tend to be a bit obsessive about these things... I know that no code is likely to be perfect, we all make unintentional mistakes; but I could never just ignore code with blatant mistakes and problems.
The thought of deliberately writing code that is hard to read, contains pointless conditionals that don't change the code flow, getters that don't return anything, control initialisers that are potentially writing out massive video files and not actually doing any control initialisation, etc. just goes against everything I have learned and practiced over the past thirty something years.
-
Jun 15th, 2022, 02:28 PM
#50
Addicted Member
Re: [RESOLVED] About a single instance of a For Next loop
Yes, I know, and I agree. But I mean that there are some people that don't want to understand programming, just want things that work and don't care how or why.
-
Jun 15th, 2022, 02:33 PM
#51
Re: [RESOLVED] About a single instance of a For Next loop
Right, but if you look at the threads the OP has created over the past many, many years, they often are him asking for feedback or suggestions on his code, him getting a tremendous amount of suggestions, and him implementing exactly zero of them.
My conclusion is, he's probably just doing the best he can...
-
Jun 15th, 2022, 02:47 PM
#52
Addicted Member
Re: [RESOLVED] About a single instance of a For Next loop
 Originally Posted by OptionBase1
he's probably just doing the best he can...

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
|