|
Sorry,
code you have provided works for creating a single array of strings for all substrings.
My problem is to store all sustrings started with delimeter "a" should be stored in one array of strings and all sustrings started with delimeter "b" should be stored in another array of strings.
So that i can get two arrays of strings from the string provided.
Thanks for your consideration
colgateas900197
|
|
|
|
|
I misunderstood the question... so let me ask you this:
The string you have; is that one long string a###b########b##### or does it contain line breaks? Like the one you displayed?
a688899987788866766655555444330000000300FFFFFFFFD
aF00000000000000000000000000000AAABB8500FFFFFFFFD
a000000000000000000000000000000666567400FFFFFFFFD
bF000000000000000000000000000008AABAA700FFFFFFFFD
bF0000000000000000000000000000079AAA9800FFFFFFFFC
aF00000000000000000000000000000A98BA9700FFFFFFFFC
b000000000000000000000000000000EEEFFEE00FFFFFFFFB
a000000000000000000000000000000EEFFFFF00FFFFFFFFC
bF00000000000000000000000000000EEEEFED00FFFFFFFFC
a000000000000000000000000000000BCDDEDA00FFFFFFFFD
bF00000000000000000000000000000BDEDDDA00FFFFFFFFC
b000000000000000000000000000000666654400FFFFFFFFD
Ask not whether it is useful. Ask what it is useful for.
|
|
|
|
|
Its a single big string with no line breaks, within that string these delimeters are used.
its like: a###b########b#####a###########b#######a######
colgateas900197
|
|
|
|
|
OK, this is something I have needed to do myself, so I created a little example code... Hope it helsp you:
<br />
Dim strSrc As String = "aF00000000000000000000000000000AAABB8500FFFFFFFFDa000000000000000000000000000000666567400FFFFFFFFDbF000000000000000000000000000008AABAA700FFFFFFFFDbF0000000000000000000000000000079AAA9800FFFFFFFFCaF00000000000000000000000000000A98BA9700FFFFFFFFCb000000000000000000000000000000EEEFFEE00FFFFFFFFBa000000000000000000000000000000EEFFFFF00FFFFFFFFCbF00000000000000000000000000000EEEEFED00FFFFFFFFCa000000000000000000000000000000BCDDEDA00FFFFFFFFDbF00000000000000000000000000000BDEDDDA00FFFFFFFFCb000000000000000000000000000000666654400FFFFFFFFD"<br />
<br />
' LOGIC:<br />
' First we replace the delimiters 'a' and 'b' with '*a' and '*b' <br />
' to get a single string array from the source string.<br />
' <br />
' We then run through the single array and assign the individual <br />
' items to their own string array; arrA and arrB.<br />
<br />
Dim strBuild As New System.Text.StringBuilder()<br />
strBuild.Append(strSrc)<br />
strBuild.Replace("a", "*a")<br />
strBuild.Replace("b", "*b")<br />
Debug.Print(strBuild.ToString)<br />
<br />
' GETTING A SINGLE ARRAY:<br />
' Here, we split the source string into an array using the <br />
' asterisk (the '*' character) as the delimiter. This ensures <br />
' that we retain the 'a' and 'b' characters, which we will need <br />
' later on.<br />
<br />
Dim arrTemp As String()<br />
arrTemp = strBuild.ToString.Split("*")<br />
<br />
' BUILDING NEW ARRAYS:<br />
' We can now use the temporary array to build two new arrays. To <br />
' do so, we loop through the items and examine the leftmost <br />
' character. If that be 'a' then we assign the item to the <br />
' A-array; be it 'b' then we assing it to the B-array instead.<br />
<br />
Dim arrA As New ArrayList<br />
Dim arrB As New ArrayList<br />
<br />
For Each curStrItem As String In arrTemp<br />
If curStrItem.Length > 0 Then<br />
Select Case curStrItem.Substring(0, 1)<br />
Case "a"<br />
arrA.Add(curStrItem.Substring(1))<br />
<br />
Case "b"<br />
arrB.Add(curStrItem.Substring(1))<br />
<br />
Case Else<br />
'<br />
' OOPS, something weird ... we ignore this item.<br />
'<br />
End Select<br />
End If<br />
Next<br />
<br />
' DONE:<br />
' The arrA array-list now contains all the 'a' items and the <br />
' arrB array-list now contains all the 'b' items. When you get <br />
' here, you should probably deallocate variables, etc.<br />
<br />
Debug.Print("A-items:")<br />
For Each curItem As String In arrA<br />
Debug.Print(curItem)<br />
Next<br />
<br />
Debug.Print("---" & vbCrLf & "B-items:")<br />
<br />
For Each curItem As String In arrB<br />
Debug.Print(curItem)<br />
Next<br />
<br />
Debug.Print("--- END ---")<br />
Ask not whether it is useful. Ask what it is useful for.
|
|
|
|
|
Thank you!
It solved my problem... It was a great help.
Wishing you lot of best wishes.
God bless you dear.
colgateas900197
|
|
|
|
|
GREAT
Ask not whether it is useful. Ask what it is useful for.
|
|
|
|
|
i want to know, did i can use vb.net to develop the web based application?
now i'm using vb to develop the application, then my new task is to develop a web based application where it will use TCP/IP to send data, maybe some kind of server and client web based, anyone can help me?
and, i want to know, can i include also the database the the application
|
|
|
|
|
Google doesn't work where you live ?
shee_dee86 wrote: and, i want to know, can i include also the database the the application
Why would you not be able to ?
Why not use ASP.NET ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
i'm sory if i've made u mad of me, but i really want to know what is good tutorial for me to start webserver application using vb.net coz i dont know how to start using ASP.NET
|
|
|
|
|
I just answered another question from you. What frustrates me is people who are not willing to buy books, or to search for their own info, before asking the most trivial questions. Not because I mind helping, but becasue you will never learn that way.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I am using a queue of objects (workitem) to feed a thread for processing.
Public Class WorkItem<br />
Public mvDependancyGroup As String = ""<br />
Public mvStoreOutput As Boolean = False<br />
Public mvName As String = ""<br />
Public mvMethod As [Delegate] = Nothing<br />
<b>Public mvInput As Object() = Nothing</b><br />
Public mvOutput As Object = Nothing<br />
Public mvException As Exception = Nothing<br />
Public mvInQ As DateTime = Nothing<br />
Public mvStarted As DateTime = Nothing<br />
Public mvCompleted As DateTime = Nothing<br />
This works fine except for the mvInput (the array of objects representing the parameters to be passed to the delegate function). When I get a copy of the queue into an array of objects using the following code all the mvInput objects are the same values.
Public Function GetInQueue() As WorkItem()<br />
Dim oWI As WorkItem<br />
Monitor.Enter(oInQ)<br />
Dim arWI() As Object = oInQ.ToArray<br />
Monitor.Exit(oInQ)<br />
Dim arResult(arWI.Length - 1) As WorkItem<br />
For i As Integer = 0 To arWI.Length - 1<br />
oWI = CType(arWI(i), WorkItem)<br />
arResult(i) = oWI<br />
Next<br />
Return arResult<br />
<br />
End Function<br />
I'm pretty sure I am not the first to do this so:
Am I using oInQ.Array incorrectly?
Is there some magic I have missed?
The obvious work around is to turn mvInput into a delimited string which I will do if I cannot get a better resolution.
OR
Does this qualify as a Subtle Bug (like a flaming brick)
TIA
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Use a List instead, they are far easier to manage tan an array
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
The problem is caused when loading the array of objects for each WorkItem.
The array must be created inside the loop
For Each oItem As ListViewItem In lvData.Items<br />
oWI = New WorkItem <<<< This must be inside the for next loop
<br />
Dim arList(2) As Object <<<< This must be inside the for next loop
<br />
arList(0) = oItem.SubItems(1).Text<br />
arList(1) = oItem.SubItems(2).Text<br />
arList(2) = oItem.SubItems(3).Text<br />
oWI.sLabel = oItem.Text<br />
oWI.oList = arList<br />
oInQ.Enqueue(oWI)<br />
Next
|
|
|
|
|
Hello Guys Im new to VB.NET.I want to send Extended ASCII values through serial port.The values i want to send from serial port are 0A5 0F0 0A6(in decimal 165 240 166)in hexa decimal with 10 milli seconds delay among every byte.I m really struggling to send this.But when i saw this data through hyperterminal i m getting "?"
charecters and some times junk values.Kindly please help me.I m really thankful to u.
code i have written is
Private Sub ReadVI_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ReadVI.Click
Start(0) = 165
VI(0) = 240
Endd(0) = 166
If SerialPort.IsOpen = True Then
Delay = CInt(txtDelayinms.Text)
rtbDisplay.SelectionColor = Color.Blue
rtbDisplay.AppendText(vbCrLf & "Reading Phase Voltages & Currents :")
rtbDisplay.ScrollToCaret()
SerialPort.Encoding = Encoding.ASCII
SerialPort.Write(Start, 0, 1)
'SerialPort.Write(Convert.ToChar(165))
SerialPort.BaseStream.Flush()
Thread.Sleep(Delay)
SerialPort.Write(VI, Offset, Count)
'SerialPort.Write(Convert.ToChar(240))
SerialPort.BaseStream.Flush()
Thread.Sleep(Delay)
SerialPort.Write(Endd, Offset, Count)
'SerialPort.Write(Convert.ToChar(166))
SerialPort.BaseStream.Flush()
Thread.Sleep(Delay)
Else
MsgBox("Connection Not Established", MsgBoxStyle.Critical, "Message")
End If
End Sub
|
|
|
|
|
|
Hi all,
I m using crystal report in VB.net 2005(inbuild crtool) Application using Stored Procedure, I face problem when my server's IP Address or Name or Port get changed, It demands for Password and even after filling that it is not working.
I want to solve this porblem, If any boddy help me out I ll be thankful.
|
|
|
|
|
Hi,
I am using code behind aspx.cs
c#:
if (Request.Browser.Cookies)
lblBrowser.Text = "<b>Cookie Enabled</b>";
else
lblBrowser.Text = "<b>Cookie Disabled</b>";
Problem:
-I am using IE7 and from tools>Internet Option>privacy
-I am selecting Block All Cookies
-when again I am tring to run my code it showing cookie Eanbled.
Can U solve this problem or give me some relative code.
Thanks
Ashish
|
|
|
|
|
This is the wrong forum. This is the VB.NET forum, you want the ASP.NET forum. You're not even using VB.NET for your code behind
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I have a small application that I am running in the system tray using the NotifyIcon control. That functionality is working well. The form is set to Minimize initially and shown when the user clicks the tray icon. The problem is where the form displays. I want it to display in the lower right corner of the screen right above the system tray. Here is the code used to display the form:
Private Sub frmMain_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Activated
Me.SetDesktopLocation(My.Computer.Screen.WorkingArea.Width - Me.Width, My.Computer.Screen.WorkingArea.Height - Me.Height)
End Sub
I have also tried:
Me.Left = SystemInformation.WorkingArea.Width - Me.Width
Me.Top = SystemInformation.WorkingArea.Height - Me.Height
I have tried both sets of code in both Activate and Form Load. Because of the "start minimized" nature of the app, initially both result in a Top and Left of -32000 because the form is not technically shown. At least that's my take.
It's only off by half the form the FIRST time the form is shown and then it jumps to where I want it to be from then on. I've tried to show the form, then quickly hide it but this seems ridiculous.
Does anyone have any suggestions?
Thanks, Joe
|
|
|
|
|
Screens.PrimaryScreen might be what you need.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I am correctly reading the size of the screen (only one in play, here). The actual assignment fails on initial load due to the minimized nature of the app. Once the form is fully shown, the properties are set correctly and, after that, it displays in the correct location.
Joe
|
|
|
|
|
Joe Surls wrote: Once the form is fully shown, the properties are set correctly and, after that, it displays in the correct location.
Can't you just set the form's Visible property to False, then "show" it as you do now, and finally set the Visible property to True?
Ask not whether it is useful. Ask what it is useful for.
|
|
|
|
|
i want to know what did i need to start make a web base application in vb net, i hope someone can help me..
|
|
|
|
|
Use ASP.NET (Visual Web Developer 2008) from microsoft.
Lloyd J. Atkinson
"Logic will get you from A to B, but imagination will take you everywhere" - ALbert Einstein
I look at Microsoft, and turn to my poster on the wall saying: "Bang head here in case of stress".
|
|
|
|
|
Probably the ability to use google would help.
There's a free IDE, the Visual Studio Express Edition for Web Developers, or something. It does ASP.NET.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|