Solved

Addin

Posted on 2001-06-26
10
233 Views
Last Modified: 2010-05-02
Hi i want to be able to modify code while a project is running...i was thinking like make the code in a file and then just modify the code in the file but how would i run the code does any one have an idea of like a code processor so i can make addons for my programs...


Thanks BrianG.
0
Comment
Question by:BrianGEFF719
  • 5
  • 4
10 Comments
 
LVL 22

Expert Comment

by:rspahitz
ID: 6229539
Build a VB interpreter.  The only practical way to change compiled code on the fly is to have the process build a dll that can be dynamically changed while the program runs.  Normally this is dangerous, but I think .NET is attempting to deal with it.
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 6229746
0
 
LVL 19

Author Comment

by:BrianGEFF719
ID: 6230532
I'm writeing my own code to run through the code and perform preset functions...i have a problem though when trying to parse the code to extrace a bit of code i have trouble...points will be awarded to anyone that can tell me why the heck this code doesnt work!

Public Sub process_names()
varTmp1$ = Form3.Text1
For xp = 1 To Len(varTmp1$)
strt$ = Mid(varTmp1$, xp, 9)
        If strt$ = "[(START)]" Then
            xst = xp
            For qp = xst To Len(varTmp1$)
            so$ = Mid(varTmp1$, qp, 7)
                If so$ = "[(END)]" Then
                    est = qp
                    c$ = Mid(varTmp1$, xst, Len(varTmp1$) - est)
                    MsgBox c$
                    GoTo oj:
                Else
                End If
            Next qp
        Else
        End If
oj:
est = ""
so$ = ""
xst = ""
Next xp
End Sub
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 22

Expert Comment

by:rspahitz
ID: 6232175
Well, your code is not the how I would write it but...

1) What is your goal, that it's not working?  Are you trying to display the stuff between the start and end codes?

2) The line Mid(varTmp1$, xst, Len(varTmp1$) - est) is displaying a substring starting at xst.  xst is where it first found [(START)], rather where it ends...
  Change: xst = xp
  To: xst = xp + 9
And est is where it first found [(END)], which is the end point, so...
  Change:  Mid(varTmp1$, xst, Len(varTmp1$) - est)
  To: Mid(varTmp1$, xst, est - xst)

Personally, I'd use the INSTR function to find the desired strings, which will give you the starting position of that string.  This circumvents the loops and makes it easier to extract the text.  This is similar to your code, but using instr rather than the loops:

varTmp1$ = Form3.Text1.text
xp = instr(varTmp1$, "[(START)]")
if xp>0 then
  xst = xp+9
  qp = instr(varTmp1$, "[(END)]")
  if qp>0 then
    c$ = mid$(varTmp1$, xst, qp-xst)
  else
    msgbox "end not found"
  endif
else
  msgbox "start not found"
endif
0
 
LVL 22

Accepted Solution

by:
rspahitz earned 100 total points
ID: 6232185
Anothing thing, being that you're using "goto" and "$", I'm guessing that you learned BASIC long ago, before the advent of object-oriented programming.

I'd suggest picking up a book or taking a class because there's a lot of worthwhile stuff here.  I struggled for about 6 months to get up to speed on VB, and I'd been doing BASIC for over 10 years before that.  then it took me several more years to really understand how the object-oriented stuff works, but now it's a lot easier to code.

(Also, look up "Option Explicit" and "Variable Types".)
0
 
LVL 19

Author Comment

by:BrianGEFF719
ID: 6244274
Thanks for your help...i got it fixed before you responded...and the thing is...there is multiple "{STARTS}" and "{ENDS}" so instr is not an option... :(

And yes I have been using basic for a long time i first started with QBASIC that comes with windows 3.1 and i've been doing it ever since...i'm going to get a book i think...i'm going to give you points anyway just because you took the time to respond...thanks a lot


Brian.
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 6249541
Thanks.  If I can be of any more assistance, feel free to reply here.
0
 
LVL 19

Author Comment

by:BrianGEFF719
ID: 13175807
wow, I wrote some horrible code back in the day :(
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 13188326
Welcome back and I suppose to the world of object-oriented programming.

BTW--every year, there's plenty more to learn, so don't put those books down just yet...
0
 
LVL 19

Author Comment

by:BrianGEFF719
ID: 13188364
LOL, I know I learn more everyday, but just looking back at this code makes me laugh to think I wrote such crappy code!!!

lol
-brian
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question