|
Someone posted this code on another forum. It seems to work pretty well.
Dim Equation As String = "4+sqrt25"
Dim Matches As System.Text.RegularExpressions.MatchCollection = _
System.Text.RegularExpressions.Regex.Matches(Equation, "sqrt(?<number>\d*)")
For Each Match As System.Text.RegularExpressions.Match In Matches
Dim MyDbl As Double = Math.Sqrt(CDbl(Match.Groups("number").Value))
Equation = Equation.Substring(0, Match.Index) & MyDbl.ToString & _
Equation.Substring(Match.Index + Match.Length)
Next
MessageBox.Show(Equation.ToString)
|
|
|
|
|
It works for a single value, but with more than one value the position in the Match objects will not match the string any more.
If you for example have the string "1+sqrt25+sqrt16+123456", you will get two matches at position 2 and 9. The first match will correctly be replaced so that the string contains "1+5+sqrt16+123456", but now the match at position 9 will no longer match the contents of the string. The second replace will replace "6+1234" instead of "sqrt16", so the final result is "1+5+sqrt1456" instead of "1+5+4+123456".
Looping through the matches in reverse order would work, though, or putting the result in a separate string.
---
b { font-weight: normal; }
|
|
|
|
|
|
how to insert a picture item into a listbox??? not text but picture!
Adrian De Battista: .Net Programmer, Java Programmer and Web Designer.
|
|
|
|
|
A listCtrl allows you to set an icon, your other option is to write an owner drawn control, or search CP for one, there's bound to be several.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
wat is listCtrl?? im new of this word! :/
Adrian De Battista: .Net Programmer, Java Programmer and Web Designer.
|
|
|
|
|
Actually, it may be called a ListView.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
OWWW IC! this is my last question! can you tell me how enter an icon into the listview please?? thanks alot!!
Adrian De Battista: .Net Programmer, Java Programmer and Web Designer.
|
|
|
|
|
You just create an image list, associate it with the control, and set the image index within the list for each item.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
how to insert pictue to it
mail me at rajesh.batchu@cesltd.com
|
|
|
|
|
Exactly as I said, which bits confused you ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
ok i get used to it for the listview! thanks alot Christian !!
Adrian De Battista: .Net Programmer, Java Programmer and Web Designer.
|
|
|
|
|
how can i programmatically put an image in an item?? and how can i send a picture via parameters please??
Adrian De Battista: .Net Programmer, Java Programmer and Web Designer.
|
|
|
|
|
HELLO, CAN YOU HELP ME ON HOW TO INSERT AN IMAGE INTO A SUBITEM USING CODE ONLY! I AM CREATING A MESSENGER AND I WANT TO INSERT THE CONTACTS PICTURE .. BUT I WANT TO MAKE THE CODE TO INSERT THE PICTURE BY A PATH FOR EXAMPLE: "C:/INDEX.JPEG". HOW CAN I MAKE THIS?? THANKS ALOT!!
Adrian De Battista: .Net Programmer, Java Programmer and Web Designer.
|
|
|
|
|
Hello,
I am creating a application that can connect any sql server on the network.
The customer would like a dialog box to be able to find a instance of a server, and then enter the password and username to get a list of all the database they want to connect to.
Does anyone have any examples projects in vb.net that does something like this.
I will be most grateful for any code.
Thanks in advance,
Steve
|
|
|
|
|
The .NET Framework 2.0 has the SqlDataSourceEnumerator[^] class to do this for you. It returns a DataTable with the information that you're looking for.
We're not going to write the code for you. You have to take a stab at it first. How else are you going to learn what works and what doesn't?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
my excel file contains no field headings
when i uploading the data the first row of the excel file become
the field's headings of the dataset.
how to avoid this.
ie.i have to save the first row also to the dataset
|
|
|
|
|
First, don't start a new thread for this. Keep it in your original thread and reply to the poerson who responded to you.
Next, let's see the code you used to import the Excel file. Whatever you did, you told the process to treat the first row as headers.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
hi,
connect the excel with oledb.then
MyCommand = New System.Data.OleDb.OleDbDataAdapter( _
"select * from [Sheet1$]", MyConnection)
ds = New System.Data.DataSet
MyCommand.Fill(ds, "delgrpmember")
For currentRow = 0 To ds.Tables(0).Rows.Count - 1
Dim i As Integer
Dim newRow1 As DataRow = dsExcelExport.Tables("delgrpmember").NewRow()
For i = 0 To colcount - 1
newRow1(i) = ds.Tables(0).Rows(currentRow)(i)
Next
dsExcelExport.Tables("delgrpmember").Rows.Add(newRow1)
Next
daExcelExport.Update(dsExcelExport, "delgrpmember")
In this the first row of the Excel file not contained in the Dataset.I have to import all the used rows including first row to the Dataset.
my Excel file has no headings.
can u help me
|
|
|
|
|
viji] wrote: connect the excel with oledb.then
And the code that you used to do this?? Especially the connection string...
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I press the Enter key the focus jump into next row
How can stop automatic row selection.
Continue...
|
|
|
|
|
hi,
i have uploaded an excel file into a dataset .but it not containing the first row of the excel file.
|
|
|
|
|
That is because the database driver thinks that the first row contains field names. You have to specify somehow that it doesn't. I don't know how, but at least you have something to look for...
---
b { font-weight: normal; }
|
|
|
|
|
hi, this is chandu,
How to generate seriel no. based on date wise ?
if date is changed then no should start from 1,2,3,4,5,....like.
chandu
|
|
|
|
|
Chira Chandra wrote: if date is changed then no should start from 1,2,3,4,5,....like.
You mean yuo want your number to start with the actual date ? I don't understand what your question is. Do you want to append the date to your serial number, or do you want suggestions for an algorithm that creates serial numbers you can then decode to get back a date ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|