I am writing a app in .NET which will generate random text based on some input. So if I have text like "I love your {lovely|nice|great} dress" I want to choose randomly from lovely/nice/great and use that in text.
I would like to use nested tokens, a similar question was asked in this thread [URL While this did address how to do it with a single instance, I was wondering how to do it with multiple instances in a string. ie.
input to textbox1 "I {love|like} {blue|red|orange|pink} its my {favorite|worst} color "
Press a button and would output a random word in the brackets to textbox2/msgbox similar to. "I like red its my favorite color" or "I love pink its my worst color"
Ok. So I have a form, a textbox, and a RichTextBox. In the RTB, there is justsomemiscellaneoustext. In the textbox, it says "Save "Test"". When I press Button1, I want my program to parse the text in the textbox, find "Save", and realize that means to save the text in the RTB to a txt file with the name "Test" (the text next to 'save' in quotes).
I'm writing something that will examine a function and rewrite that function in another language so basically if inside my function F1, i have this line of code var x=a.b(1) how do i break up the function body into symbols or "tokens"?I've searched around and thought that stuff in System.Reflection.MethodInfo.GetMethodBody would do the trick however that class doesn't seem to be able to have the capabilities to do what i want..dit 2:basically what I'm trying to do is to write a program in c#/vb and when i hit F5 a serializer function will (use reflection and) take the entire program (all the classes in that program) and serialize it into a single javascript file. of course javascript doesn't have the .net library so basically the C#/VB program will limit its use of classes to the .js library (which is a library written in c#/vb emulating the framework of javascript objects)
I want the Function to accept List(Of String), Array & String and similarly return List(Of String), Array & String respectively. The Function simply adds a string (month) to the input collection. I just want to use it for string, array and list with needing to think of conversions.
Basically I have a webresponse stream:dim lol as string = readstream.tostring there is a lot of information within the string but only one link starting with http: located near the end of the string - however there is no constant character point where I can start... (i.e. 38)
I want to extract the link from the string i.e. dog cat plane car [URL]..that is approximately how it looks above - words and url substituted I want to just extract [URL]..I had an idea of parsing the string from http: to the end Then after that splitting the string up again to remove the }], however it does not return anything
I got an app, which receives data via a R232 port, convert it to a string and on the other side I got a database, where the strings are saved. How can I find a way to compare the string with all strings in one database column and get back the another stringform the same row in this database. I never programmed a database
I have buttons generated through code (dynamically). I have to associate an event (the same) to them. I use AddHandler button.click, AddressOf mysub.The issue is that mysub gets a string (mysub(string)), but AddressOf doesn't accept a parameter inside the routine. How can I do this? Using also an alternative to AddressOf.
EDIT:
Public Class Form1 ... Private Sub mysub(ByVal sender As Object, ByVal e As System.EventArgs, ByVal str As String)[code]......
These is the content of my txt file which is saved in D drive in my pc abc,1,2,3..I tried the flowing but it didn't work:[code]I am getting error on this line.. data = line.Split(","c)...it says this line isn't in use anymore or something and that I rather use LineInput but thats asks for filenumber and i don't know what that is. I am sorry but I am a complete beginner. what else can I try? [code]ok that error is gone now but now if I want to add these values to a list box..how can i do that?
I have a field that I display via: String.Format({0:c},amount) This produces the string "$28.28" However, when I try to convert back to a decimal amount, I get an incorrect format exception: amount = Decimal.Parse(amount.Text, NumberStyles.Currency) I also tried it with NumberStyles.AllowCurrencySymbol with the same results. I verified that the value in amount.Text is "$28.28". Am I missing something? Shouldn't these two operations use the same currency symbol and formats?
I Ported this code from a code project article in c# called Nscript
heres the code
Base App Imports System Imports System.IO Imports System.Resources
[code]....
Okay Now I only get two errors (I dont know how to solve them)
Error3Class 'BaseApp' must implement 'Sub OnCompilerError(errors() As CompilerError)' for interface 'IScriptManagerCallback'.
And
Error4Class 'ScriptManager' must implement 'Sub CompileAndExecuteFile(file As String, args() As String, callback As IScriptManagerCallback)' for interface 'IScriptManager'.
But What I would also Like to know (as well as how to fix the errors), is would the code work?
Problem: Your task is to take input from the user in string and give the following options to the user in a menu.
1- Find a String 2- Create sub-string 3- Erase a portion of a sting 4- Replace a word in the string 5- Count number of words and characters in the string without spaces. 6- Capitalize first character of each new sentence and convert the rest of the characters to lower case. 7- Sort all the words in alphabetical order. (Use Bubble sort algorithm to perform sorting).
To perform all the above mentioned tasks you can only use pointers. Create a function to perform every task.
So strings are reference types right? My understanding is a reference to the string in the heap is passed even when you pass the string ByVal to a method.
Im working on a program and I get this "Value of type '1-dimensional array of String' cannot be converted to 'String'." heres the code that gets this error:
I don't understand why the line final.join etc pops up with these errors!! Value of type 'String' cannot be converted to '1-dimensional array of String' And Access of shared member, constant member, enum member or nested type through an instance; qualifying expression will not be evaluated This is my code.
when i transfer the bytes sent by the client program to a string the string length is affected.when i put the bytes sent by the client program to a message box. it returns the corrrect text. but when i check the length it will return 8192 or higher. but the actual size is just 5.
My Code
Dim tcpClient As TcpClient = tcpListener.AcceptTcpClient() RichTextBox1.Text = RichTextBox1.Text & vbNewLine & "Connection accepted." ' Get the stream[code]....
I'm trying to code a program but this error repeatedly shows up and I can't for the life of me figure it out EValue of type 'String' cannot be converted to 'System.Windows.Forms.TextBox'. It appears in relation to this code
I need to do this to every line in a file and save the # five Element in an array. I keep getting (error code 1 Value of type '1-dimensional array of String' cannot be converted to 'String'.)
NOTE: if I change ( Dim Lineoftext(1) to Dim Lineoftextt works) (It does't seem to work with arrays)
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
What I need is to be able to put in a SortedList a combination of two fields that are non-unique, but the pair is (like database composite keys).More precisly, i have my list, and i want to be able to do this with it
Dim myList = New Generic.SortedList(Of String, String) myList.add("aaa","aaa") myList.add("aaa","bbb")
I'd like to convert a string which contains a decimal number into string that contains the binary value, the octal and the hexadecimal value of that decimal number.Afterwards I also like to convert a string containing a binary, octal and hexd. number into a decimal string.Basically I'm looking for the functions:
dec2bin dec2oct dec2hex bin2dec oct2dec hex2dec
I'd not prefer to rewrite a function, I'm sure the framework must have these functions already.
I am trying to the copy the value from string to char array using String.CopyTo() method.
Here's my code
Dim strString As String = "Hello World!" Dim strCopy(12) As Char strString.CopyTo(0, strCopy, 0, 12)
[code]....
Edit : I get the this error at runtime.ArgumentOutOfRangeException Index and count must refer to a location within the string. Parameter name: sourceIndex
I've got an issue with a program I am writing. The specific issue is replacing characters in a parent string by finding, and matching, specific characters within it that are parsed from an external xml file. It's for a chat-like client.Here's the 2 classes I am using to pull the emote strings, titles, and id from external XML:
Imports System.Text.RegularExpressions Imports System.Xml.Serialization Public Class emote