?
Solved

Addin

Posted on 2001-06-26
10
Medium Priority
?
236 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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 400 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month15 days, 17 hours left to enroll

741 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