Solved

Addin

Posted on 2001-06-26
10
231 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 69

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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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…
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…
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…

864 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now