473,387 Members | 1,545 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

VB mini programming language

Hi!!! Like you can see in my name I prefer a Borland programs, but today I have start the
Microsoft programs. Like a basic of the Microsft programs is Visual Basic 6,5,4 or older.
I need help. I'm making a mini programing language in VB so I need to know how can I detect a
word that is writen.
Example =>Start

Var a:integer;

Example =>End.

I need to detect the word 'Var' and to bold it and tht will be like 'Dim' in VB or
something like tahat.
I need to detect a letter after 'Var' so tahat will be the name of the (i don't know
how to tell that on English).
I need to detect ':' so taht will be the end of the (i don't know
how to tell that on English).
I need to detect the 'integer' that will be a type of the (i don't know
how to tell that on English).
I need to detect ';' , that will be the end of the statement.

So any help here isn't bad idea,I think ?


BorlandDelphi $$$ The best programs I ever see it $$$
Mar 29 '08 #1
5 2241
Robbie
180 100+
I think the word you want is 'variable' - something to store a value, right? ;)

You're wanting to make some kind of text (source code) editor in VB6 for another programming language?

Well, the first immediate problem I see is that I don't know about a 'rich text' control in VB6. You'd need something more than just a VB
TextBox control because you can't make specific parts of a TextBox's text be bold or of a different colour to the rest of the text in the same control.

To actually detect the things you want to detect - such as 'var' or ':' - you can use InStr(). That function looks for a small string within a larger string, and it tells you the position in the large string at which the smaller string appears, or gives back 0 if it found nothing. You use it like this (VB 6 code) :
Expand|Select|Wrap|Line Numbers
  1. InStr(PositionToStartLookingFromWithinTheLargeString, LargeString, SmallString)
  2.  
  3. TextPos = InStr(1, "hello everyone", "e") 'TextPos becomes 2
  4. TextPos = InStr(4, "hello everyone", "e") 'TextPos becomes 7
  5.  
You could then use the information which InStr() returns to know the start and end positions of the text which should be bold (i.e. 'var'). However, how you actually make this text be bold, I don't know (you need some 'rich text' control, and I don't even know if that exists, let alone where you'd find a free one).

I hope this at least helps a little...
If you do find out about some Rich Text Edit control, please let me know, because I'd love to have one too!
Mar 30 '08 #2
I just ask for help. My new mini programming language is my problem. I just asko for help. If you want to help do it, if you don't then don't

BorlanDelphi %The best programs I ever see it"
Mar 31 '08 #3
Robbie
180 100+
I just ask for help. My new mini programming language is my problem. I just asko for help. If you want to help do it, if you don't then don't"
Huh? I really was trying to help.

I recommend you check the InStr(), which I mentioned in my previous post, and maybe also InStrRev() (which scans backwards through the string). Using Mid(), you can also extract a piece of text within a string.
Expand|Select|Wrap|Line Numbers
  1. 'Mid works like this: Mid(AllText, StartCharacter, NumberOfCharacters)
  2. Text = Mid("Something", 4,2) 'Text becomes "et"
  3.  
So, you could use InStr() to get the position of "var" within a line of the text, add 4 to that value (then you'll be at the position of the start of the variable's name). Then you can use Mid() to extract the name of the variable. If you want something like "as string" to be detected, you can use InStr() to find the position of " as ", then use Mid() to extract what's in between "var " and " as ".
Example:

Expand|Select|Wrap|Line Numbers
  1.     WholeText = "    var MyVariableName as string"
  2.     StartPos = InStr(1, WholeText, "var ") + 4
  3.     EndPos = InStrRev(WholeText, " as ")
  4.     VarName = Mid(WholeText, StartPos, EndPos - StartPos)
  5.  
Now VarName is "MyVariableName". Using that kind of technique, you can use InStr() to look for keywords such as "var" within typed text (code) to use as waypoints for finding specific text which the user typed.
Apr 1 '08 #4
Oh,sorry. I don't have enought time to read. Well thanks for the
word 'varible' ( I need to remember it) and about the function
InStr(). Thanks a lot for helping me. You can bold, color, underline
and other thinks whit the text in RichTextBox or TextBox. By the way
if you need a help about Rich and Text Box let me know,I will help you.

PS: I need a book for computer. I need a book to explain me
how work all the electronic things,CPU,RAM,registry. I like to know
how go the bits in the CPU , how work RAM or whit sample words
I LIKE TO KNOW HOW WORK HARDWARE. I like to know where go the
electric power and how work the electric chips and ways in the
MOTHER BOARD. I like to programming whit the CPU and RAM. The
lowest and more powerfull programming languages.

By the way, tommorw I will publish the *.exe Instalation File
and of cource the new version of Easy Extractor v 1.03 whit
color and more features. Take the full version and use it.
It's great tool. Next tool will be a Easy Open\Save tool for VB6 or 5.
You addit like control and you can use it to open or save a *.txt.
Soon you will enjoy whit the Easy Extractor tool. Do someone
like to publish his own program????

BorlandDelphi *****Delphi - the best program *****
Apr 2 '08 #5
Robbie
180 100+
Oh,sorry. I don't have enought time to read. Well thanks for the
word 'varible' ( I need to remember it) and about the function
InStr(). Thanks a lot for helping me. You can bold, color, underline
and other thinks whit the text in RichTextBox or TextBox. By the way
if you need a help about Rich and Text Box let me know,I will help you.

PS: I need a book for computer. I need a book to explain me
how work all the electronic things,CPU,RAM,registry. I like to know
how go the bits in the CPU , how work RAM or whit sample words
I LIKE TO KNOW HOW WORK HARDWARE. I like to know where go the
electric power and how work the electric chips and ways in the
MOTHER BOARD. I like to programming whit the CPU and RAM. The
lowest and more powerfull programming languages.

By the way, tommorw I will publish the *.exe Instalation File
and of cource the new version of Easy Extractor v 1.03 whit
color and more features. Take the full version and use it.
It's great tool. Next tool will be a Easy Open\Save tool for VB6 or 5.
You addit like control and you can use it to open or save a *.txt.
Soon you will enjoy whit the Easy Extractor tool. Do someone
like to publish his own program????

BorlandDelphi *****Delphi - the best program *****
A lot of that kind of low-level stuff will be HARDER (more effort required) to do in Visual Basic, because VB is meant for making more general programs (not so 'accurate', if you know what I mean - I can't word it properly) much more quickly.

Yes, please tell me about a RichTextBox! There isn't one in the VB6 toolbox by default, so if there is something in 'Project -> Components' which I should be ticking, please let me know what that is! I don't mind playing around with it by myself (in fact, that's how I've taught myself a lot about VB), so you don't need to go into any more detail than simply how to add the RichTextBox control to a form (in VB6). Well... if I have any problems afterwards, I can post a question afterwards. ;)

I'm glad I could help you, too.
Apr 2 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Carlos Ribeiro | last post by:
I'm doing some experiments with mini declarative languages (as explained by David Mertz in http://www-106.ibm.com/developerworks/library/l-cpdec.html) in Python, with the intention to use it as...
181
by: Tom Anderson | last post by:
Comrades, During our current discussion of the fate of functional constructs in python, someone brought up Guido's bull on the matter: http://www.artima.com/weblogs/viewpost.jsp?thread=98196 ...
41
by: Michael Strorm | last post by:
Hi, I'm in the middle of "teaching" myself C++. Having skimmed some of the "Teach Yourself C++ in 21 Days" book, I got a feel for the language, at least. Then I bought "The C++ Programming...
5
by: abhishekjha10 | last post by:
Hello everybody, I am trying to create a mini OS in C. Can you help me with some helpful links and sites. Thankyou. Abhishek Jha.
3
by: alpa shah | last post by:
Hi, please suggest me Mini project topic in ASP language....
3
by: aurora | last post by:
This is an entry I just added to ASPN. It is a somewhat novel technique I have employed quite successfully in my code. I repost it here for more explosure and discussions. ...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
5
by: =?Utf-8?B?R3VpbmVhcGln?= | last post by:
Hi, I just wrote a mini C# lab for myself, I think it may be useful for others, so I shared it on my blog. If you often need to write only serveral lines of code and don't want to waste time on...
1
by: =?Utf-8?B?VGhhZA==?= | last post by:
My Windows media player won't find the mini dvd - any help on how I can play these mini dvd's recorded on my camcorder in media player? I have media player 9. -- Thanks, Thad
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.