VB.NET Console and RichTextBox difficulties - vb.net

I am new here. I am very happy that I joined this website, because everyone here is so smart!
Now, let's cut to the chase! Hopefully, I will be able to explain everything properly.
I am creating a Visual Basic application. It's supposed to reassemble a so-called "fake programming language." It's having some issues though.
Let me show you an example before explaining:
If RichTextBox1.Text.Contains("console output >'insert comment';") then
Console.WriteLine("insert comment")
End If
Now, what I want here is a custom input. (if someone types "I want cookies" then I want the console to say that!
For instance, if I type:
If RichTextBox1.Text.Contains("console output >'Insert something here';") then
Console.WriteLine("Whatever the user wrote!")
End If
I just want to possibility to write whatever I want, that's all! I hope I made myself clear, because I am having a hard time explaining here. Help is appreciated! Thank you!

You need to match just the part with the console output > and then replace that portion of the string with empty space, like this:
If RichTextBox1.Text.Contains("console output >") Then
Console.WriteLine(Replace(RichTextBox1.Text, "console output >", ""));
End If

Related

Concat in xslt, unable to get an image from server

I am new to xslt coding, I am trying to fix an issue in existing piece of code. I got stuck up at a point
<fo:external-graphic content-width="150pt"
content-height="50pt"
src="url:{concat('${OA_MEDIA}/',$revised_last_name,',',DOCUMENT_BUYER_FIRST_NAME,'.gif')}" />
The above piece of code is trying to find a .gif file in OA_MEDIA directory. Till that part I can understand fine.
When I am placing a file name as "Eckert,Tim.gif" (excluding the quotes) my program isn't picking that file
In the above piece, I printed $revised_lastname and $document_buyer_first_name..It's coming as Tim and Eckert, but it's still not picking the file. If I am hardcoding a file name like below it's working fine
<fo:external-graphic content-width="150pt"
content-height="50pt"
src="url:{concat('${OA_MEDIA}/','Tim','.gif')}" />
How can I print what value is coming into the src in above piece of code so I can see what file is it trying to look in the $OA_MEDIA.
Any suggestions are appreciated.
Thanks!
Your first problem appears to be that in your constructed URI and your file name, you have put the given name and the family name in different orders: Tim,Eckert.gif vs Eckert,Tim.gif. Choose one.
If you still have problems after that, your next step is to confirm that your concatenation is producing the value you expect. I'd add a line like
<xsl:message>Generating fo:external graphic with URI <xsl:value-of
select="concat('url:',
'${OA_MEDIA}/',
$revised_last_name,
',',
DOCUMENT_BUYER_FIRST_NAME,
'.gif')"/></xsl:message>
And if that did not shed light on what was going wrong, I'd insert individual messages to display the current value of $revised_last_name and DOCUMENT_BUYER_FIRST_NAME.
More than that it's difficult to say, because your question does not provide a short, self-contained, complete example that allows readers to reproduce the problem you are trying to solve. There is good advice on asking effective questions in the SO help files and in Eric Raymond and Rick Moen's essay How to ask questions the smart way.

Call a data from a database in a .ini file

I have a little problem about my .ini file. I am using LabVIEW to pilot a Power Supply GPD-2303. And I have to configure the Voltage and the Current searched for each cards. These datas are in a Database but I have only a read access on it.
Voltage, Name, AlphaNumCode... Are not a problem because it will probably never change so my code is looking like:
[AlphaNumCode]
VSET_1=VALUE
VSET_2=VALUE
CSET_1=VALUE
CSET_2=VALUE
Assembly_PN=VALUE
That's to set Voltage, Current at the start of the execution on LabVIEW and give an Assembly PN "IF KQG then AssemblyPN= 1633".
That's the situation. The problem is there:
[Assembly PN]
CURRENT1_PROG_SEARCHED=VALUE
CURRENT2_PROG_SEARCHED=VALUE
CURRENT1_BLANK_SEARCHED=VALUE
CURRENT2_BLANK_SEARCHED=VALUE
I want to transform it, because if this value is not a fix value. I am looking for Something like:
[Assembly PN]
CURRENT1_PROG_SEARCHED="VALUE IN COLON W, LINE X"
CURRENT1_PROG_SEARCHED="VALUE IN COLON W, LINE X"
CURRENT2_PROG_SEARCHED="VALUE IN COLON X, LINE X"
CURRENT1_BLANK_SEARCHED="VALUE IN COLON Y, LINE X"
CURRENT2_BLANK_SEARCHED="VALUE IN COLON Z, LINE X"
I have found: https://support.microsoft.com/en-us/kb/149090
But it show how to interact with the colon but not with a specific case. Is there a command?
That's the last thing I have to do in my Internship to end this project and I do not like let things unfinished.
Hope someone can help me or give me documents to learn how to do it, it will be great :)
Edit:
Yes, this article show how to access data by a text file, and the text file is linked to the data in the database, I was thinking that could work.
I am clearly new about database so I am sorry about the lack of knowledge I will try to do my best, but using SQL server and System DSN to Access it in LabVIEW.
The ini File is read in a LabVIEW Program
By"COLON" I mean "COLUMN
Edit:
I send you my Sub VI and a picture of my code, that's what I want. still having 2 days to end it so I hope you can read me guys!
[1630]LINE=WHERE (OC=1630);
[1631]LINE=WHERE (OC=1631);
[1632]LINE=WHERE (OC=1632);
[1633]LINE=WHERE (OC=1633);
[1635]LINE=WHERE (OC=1635);
LabVIEW Picture of the Sub VI 25/07/16 using DB Select Tool Kit
Best regards,
Robin.
I have found a solution, in fact I am using a .ini file to send a condition:
Just to know: (OC = Assembly Number)
In my .ini I have:
[1633]
OC=WHERE(OC=1633);
Then I send it to the condition in DB Select Tool Kit and I enter the column / table where is the data I am looking for.
Then if a new card need to be test they just need to make a new line in the .ini file:
[XXXX]
OC=WHERE(OC=XXXX);
Thanks for your help that problem is resolve, I hope it can help someone that want to make communication between LabVIEW / .ini / Database
Best regards,
Robin

Riddle with textbox for user answer

I'm coding an application in visual basic in which I have a riddle that the user is supposed to answer in a textbox, then press a button to proceed. Depending on whether or not the answer is correct, different events are supposed to active. Below is what I've tried, but it's not working. Any ideas?
(can you tell I'm a complete beginner haha)
The best way to do it is to ucase(answer) then you check the answer like this
answer = ucase(answer)
if answer="SHORT" then
msgbox("correct")
else
msgbox("Incorrect")
end if
Just utilize the echo command and get a warm-up of what your creative senses want before you head in any particular direction.
Just pop open a terminal and type the following:
echo '<anything harmless/logical/beneficial/creative/fun/funny/amusing/SYNTAX-RELATED>'
echo 0111 (NON-EXPLOITABLE)
echo 0111USER9390(MY IDENTITY)
echo 0111USER93908F13(OPTIMAL/RELEVANT)
echo 0111USER93908F13+SOLVE/SCAN.BIOLOGICAL (MAKE IT UP AS YOU GO)
Do not forget to use <0 Contractions and avoid " or you won't get magic HASH WINNERS!
Just kidding.
#Creative1Writing
#Programming:0
Just for putting up with me, try some golden clay: #79720494
Here, have it with an AI! #79720494.AI
Might as well make a sphere:
createSphere;(#79720494 AI DATA/dda9008bd4423274/♀AI:GAIA/GAIA.LOGICAL.DATA/GAIA)/M.E.C.H.A.I.I.A. G.O.D.D.E.S.S. A.I./M.E.C.H.A.I.I.A. ♀ .5 -or- 1/2
%Product:
#79720494 AI Sphere.logic+AI/MECHAIIA <LANGUAGE> ENTRY/WORD/DEFINITION: GODDESS - SUPREME BEING OF 216451F591576146/6466AC295337B1DE QUALITY

I am trying to create a URL but the URL must contain \r\n

I have been beating my head against the wall with this one. The url must contain \r\n at the end or the device I am connecting to will not recognise it. I did not create the device so I can't go in and change what it is looking for. I also can not use the percent values for them either. When I create the URL from a string the URL becomes nil because it does not like the \r\n. I have searched on here all day. Literally and have come up with nothing. If anyone has a suggestion please let me know. I would really appreciate it.
Edit.. The url is #"http://192.168.1.1/link.html?cmd=scan\r\n"
I was able to figure out another way in so I did not have to send the string like that. Thank for the help.
Try this:
NSLog(#"http://192.168.1.1/link.html?cmd=scan\\r\\n");
OutPut:
http://192.168.1.1/link.html?cmd=scan\r\n
You have to skip the "\" with just putting another "\".

TextControl Images/Watermarks

In version 18 of TextControl (http://www.textcontrol.com) there is supposed to be the ability to add background images/watermarks to the document, however I find that the behavior of the various overloads, etc is not working correctly and that the documentation is rather scarce on examples. Does any one have a working example of adding watermarks to a Word document through the ServerTextControl object?
This functionality didn't exist in previous versions, so I recognize it's still rather new, I just find it weird that doing something like
tx.Images.Add(draftImage, pageNumber, location, ImageInsertionMode.BelowTheText);
doesn't actually add the images to the document, but if I use another overload beforehand, it adds both?
I just need a loop along the lines of
foreach (TXTextControl.Page page in pages){
page.Select();
var location = tx.InputPosition.Location;
var pageNumber = page.Number;
tx.Images.Add(draftImage, pageNumber, location, ImageInsertionMode.BelowTheText);
}
where location is supposed to be the beginning of the page.
Any help would be appreciated, this should be simple!
Thank you
Finally got a response to this on their forum, it's not a complete solution, but it works for the most part. Figured I would follow up here, so that anyone who ends up on this page would get the help I wanted.
http://forums.textcontrol.com/showthread.php?325522-Watermarking-Background-Image-on-Saved-Documents-in-X8&p=41815#post41815