Solved

Addin

Posted on 2001-06-26
10
232 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

831 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