Jump to content
Xtreme .Net Talk

vbMarkO

Avatar/Signature
  • Posts

    158
  • Joined

  • Last visited

Everything posted by vbMarkO

  1. THIS IS resolved post code later I rebuilt the code and saw plainly what I was doing wrong ... Mark
  2. Here is my code ... WHat it should do ... is loop through array with addresses in it then display them on a richtextbox However, it loops through does the first one .... then I have to click the button event again for it to get the 2nd one BUT THEN when I click button the 3rd time it doesnt do the third address it simply repeats number 2 Ok, I have moved myInt around ... I even tried putting the whole thing in a do while and then a do until HOwevr I may not hav done eithe of thos right either Please help I just need it to go through each and do to each what its supposed to Oh ... I am going to include my xml file so you can see what its pulling from and to s if you might have any sugestions as to how to do this more efficiently My XML <?xml version ="1.0" encoding ="utf-8"?> <Tulsa> <Streets> <Riverside S61="193,499,100" S71="276,708,1300" S81="400,916,1600" S91="530,1126" S101="589,1334">S Riverside Pkwy</Riverside> <Peoria S61="277,498,1300" S71="271,680,1300">S Peoria Ave</Peoria> <Lewis S61="485,498,2400" S71="485,707,2400" S81="485,916,2400" S91="553,1126,2500">S Lewis Ave</Lewis> <Delaware S61="595,470,2800" S71="595,706,2800" S81="588,916,2800" S91="589,1335,2800">S Delaware Ave</Delaware> <Harvard S61="" S71="" S81="692,916,3300" S91="" S101="">S Harvard Ave</Harvard> <Yale S61="" S71="" S81="901,916,4900" S91="" S101="">S Yale Ave</Yale> </Streets> </Tulsa> My CODE [ Dim myXML As XDocument myXML = XDocument.Load(myXMLPath) Dim myTempArr() As String Dim stString() As String = {"6100 S Riverside Pkwy", "8100 S Yale Ave", "6100 S Peoria Ave"} Dim myString As String = "" Dim myEl() As String myInt += 1 For i = 0 To UBound(stString) If myInt > stString.Count - 1 Then Exit For Else myString = stString(myInt) End If Next myEl = myString.Split(" ") For Each xa In myXML.Descendants For i = 0 To myEl.Count - 1 If myEl(i).ToString() = xa.Name.ToString() Then ' MsgBox(myEl(i)) ' <<<<< Msgbox for testing code If xa.Name = myEl(i) Then myString = Microsoft.VisualBasic.Left(myString, 6).ToString() Dim Sst As String = Microsoft.VisualBasic.Right(myString, 1) Dim streetNum As String = Microsoft.VisualBasic.Left(myString, 4) Dim tAtt As String = Sst & Microsoft.VisualBasic.Left(streetNum, 2) ' MsgBox("String equals - " & tAtt) ' <<<<< Msgbox for testing code myTempArr = xa.Attribute(tAtt).Value.Split(",") For myInt = 0 To UBound(myTempArr) rtb1.Text = rtb1.Text & "Mouse Coordinates Are: " & myTempArr(0) & ", " & myTempArr(1) & vbCrLf _ & "The Hundred Block is " & myTempArr(2) & " E " & vbCrLf & _ "Which is " & myEl(i) & " & " & Microsoft.VisualBasic.Right(tAtt, 2) _ & "st ST" & vbCrLf & vbCrLf Exit For ' Not sure about this Exit For ..... Next End If End If Next Next The future end result of this will be to remove the rtb code all together and replace it with code that will mark the addresses on a map ... I hav that code already written and it works great just ned to be able to search my xml with the addresses contained in the array and mark each point that it finds Mark
  3. Your right .... man ... it was right in front of m and I just knew I was over looking something simple Arrrgh OK then this is solved as that did the trick thanx a bunch Resolved
  4. This I think should loop through placing a picbox at each location But it only places the first one but when I debug it it appeas as though its looping through and I see the coorinates ... I'm just not seeing it happen on my app here is the code Dim PB As New PictureBox Dim myAdds() As String = {"8100 S Riverside", "7100 S Riverside"} Dim myECoord() As Integer = {400, 275} Dim mySCoord() As Integer = {916, 708} ' ToolTip1.SetToolTip(PB, "81st & Riverside Pkwy") For i = 0 To mySCoord.Count - 1 'Dim myInt1 As Integer = myCoord(0) ' Dim myInt2 As Integer = myCoord(1) With PB .Location = New System.Drawing.Point(myECoord(i), mySCoord(i)) .Size = New Size(5, 5) .BackColor = Color.Red .BringToFront() End With Me.PictureBox1.Controls.Add(PB) AddHandler PB.Click, AddressOf MyPicClicked Next Any thoughts Help much appreciated vbMarkO
  5. Yes, I like the idea ... already on to it ... in fact I am playing with it right now ... I have put together a high res map to work with ... the map covers a little more than the area I am concerned with but then thats ok ... Adresses here in Tulsa are the easiest in the world I think ... | | | ___|____ | The Dashed line Up & Down is north and South 8100 of course is 81 blocks from Admiral which is the dividing line for north south anyway then east from Riverside which at 8100 S starts at 1800 Block E Riverside is aproximately 1800 E 81 Street is 8100 S On my image the coordinates are 400, 916 400 is equal to 1800 E 916 is 8100 South WHat I would like to be able to do is determine how figure the math here as to how to calculate the coordinates If the 1800 block of 81st = 400, 916 then what would 3300 block of 81st = ?, 916 Oh and your code ... I am working with it now to loop through ... I will let you know how it turns out as soon as I have the direction I am going to take it Mark
  6. Ok the post was about making picboxes on the fly and the mouse click coordinates I hav now Solved that and the code I showed allowing me to put a single red pixel works but the pixel is so small it wont work .... I woujld lik to continue to play with that or see som help toward that or even better placing an icon like a red arrow or something like that at my coordinate .... I am now looking at modifying the code I am about to show which works great by the way ... to p-lace this programatically outsode of a mouse click but to simply place them based on addresses I pull from data that is placed into arrays ... The addresses I howed in another post of police calls in my area ... I am going to mark them on a map ... each call typ having a different color to show viloent crimes to simple traffic stops. For the first time I really see this happening Ok one last thought ... I do agree that to have a pixle or icon would be best .... SO I am open to example of how I might do this or at least see a working example of how to place multiple icons or plot points on my image map Here is my Working code .... making this htread sort o resolved though I still want to learn more about the othe approach as I only se my code as a work around Dim PB As New PictureBox With PB .Location = New System.Drawing.Point(e.X, e.Y) .Size = New Size(5, 5) .BackColor = Color.Red .BringToFront() End With Me.PictureBox1.Controls.Add(PB) AddHandler PB.Click, AddressOf MyPicClicked End Sub Private Sub MyPicClicked(ByVal sender As System.Object, ByVal e As System.EventArgs) ' Additional code here for clcik event ... but its not needed ' the result of the other code works great it places little red picboxes but ' they look like dots ... its not drawing but its functional End Sub
  7. Hey that code is working ... its just so small I didnt see it I have a pictur box with an image in it ... perhaps I should just put the image on the form and set the picbox color to transparent Yes? Cool ... it at least is starting to do something
  8. I did find this but I get an eror but it oes seem to be what I might want what do you think? Th error is with the e.graphics.drawimageun .... un something cant rember her is the code Dim bm as new Bitmap(1,1) bm.SetPixel(0,0,Color.Red) e.Graphics.DrawImageUnscaled(bm,<xPosition>,<yPosition>) Oh yeah unscaled ... anyway I tried to modify it ... but that didnt work I tried to modify it to this .. but I am not sure this is right well I know its not as its not doing anything Also this is within a Picturebpox1_MouseClick Dim mPen As New Bitmap(1, 1) mPen.SetPixel(0, 0, Color.Red) Dim g As Graphics g = PictureBox1.CreateGraphics g.DrawImageUnscaled(mPen, e.X, e.Y) Ok ... anythoughts
  9. Yes ..... but I am not sure how todo this this is why I cam up with that I have been searching fo just putting a point at the location but th only thing close I found was in C# ... I know its clos but I couldnt get it to work ... could you point me to a simple VB example or show an example?
  10. This will move one to a given location pic2.Location = New System.Drawing.Point(175, 252) pic2.Visible = True But I want to create them and I would like assign the locations based 2 things 1. Mouse click ...... 2. but would also like doing this using variables o an array of coordinate integers I tried this to create ... Dim pct As New PictureBox() pct.Location = New System.Drawing.Point(177, 228) pct.Size = New System.Drawing.Size(5, 5) pct.BackColor = Color.Red pct.BringToFront() Me.Controls.Add(pct) but I couldnt figure out how to ad the handler or assign address of for a picture box not evn sur if this is right ... I sort of think Im on the right track though This really worked fin with the button event ... I clicked on it and the red spot went right wer I wanted it to ... I know its not high end drawing stuff but I dont know about that and this is a great work around for me .. I just need to figure out how to assign the coordinates and crate the picture boxes or get the mouse click coordinate and assign it The idea is to have multiple pictureboxs acting as my littl red dots to mark my map ... sure looks like a grat idea All help appreciated .... vbMarkO
  11. Here is the code modified sort o just made it fit what I already have but .... I havent figured out yet how to compare the final results to then determine the address closest to farthest away I am putting th whole thing in so you can see what I am trying to do Note I am only pulling out South addresses here .... I tried to start with one side then do the other the East addresses Its like this |_7100 S_______|3000 E | | |_8100 S_______|3000 E | | |_9100 S_______|3000 E This very crude map above gives an idea of what I am shooting for location is just below 81st S .... we can call it 8100 anyway I am logging various crime activity within a 2 mile radius so to speak 2 miles North of 8100 which my map above only shows 1 mile but then also 2 miles E and it dos reflect aprox 2 miles The addresses are in an array in the above format ..... my thoughts or approach maybe the wrong way ... maybe there is an easier way to figure coordinates ... but my idea was simply to find the smallest number south or north of 8100 then East of 8100 .... no need to wory about W as I am against the river ..... Dim addArr() As String = {"6100 S Lewis Ave", "4100 S Yale Ave", "3900 E 28 ST S", _ "2100 S Jackson Ave", "3100 S Yale Ave", "7800 S Jamestown Ave", _ "1900 E 49 ST S", "2400 S Maybelle Ave", "7600 S Jamestown Ave", _ "2400 E 71 ST S", "9800 S Lewis Ave", "6300 S Riverside Pkwy"} For sIn = 61 To 100 For Each item In addArr If item.Contains(sIn & "00 S") Then 'lstS.Items.Add(item) Dim myInt As Integer = "7700" 'Dim sArr As New ArrayList If item.Contains(sIn & "00") Then item = Microsoft.VisualBasic.Left(item, 4) '////////////NEW PARSE CODE HERE Dim sNumArr As New ArrayList sNumArr.Add(item) Dim sInt As Integer = 7700 Dim res = From nums In sNumArr _ Let diff = Math.Abs(Convert.ToInt32(nums) - sInt) _ Order By diff _ Group nums By diff _ Into DistanceGroup = Group _ Select New With {.Difference = diff, .NumberOfMatches = DistanceGroup.Count, DistanceGroup} 'just print out to debug as an example For Each x In res ' Debug.WriteLine(String.Format("Distance {0}, Number Of Matches {1}", x.Difference, x.NumberOfMatches)) lstE.Items.Add(String.Format("Distance {0}, Number Of Matches {1}", x.Difference, x.NumberOfMatches)) For Each number In x.DistanceGroup 'Debug.WriteLine(String.Format("Original number {0}", number)) lstS.Items.Add(String.Format(String.Format("Original number {0}", number))) ' Below rtb1.text I put to se what it looked like compared to lsitbox items ' Its letting m know in the first for each ... smallest distances and largest distances ' Now I am trying to figur out how to return 1. smallest distance (which is closest) '............................................2. next small and so on .... ' this does at last give me the distances to compare ... thank you I do appreciate that rtb1.Text = rtb1.Text & number & vbCrLf Next Next End If End If Next Next
  12. Ok I have made some headway but still not there yet .... I am now getting a clean split but I realize something that I am not sure what to do with Obviously I am wanting to take the string as seen in this partial example of the string Example string Dim exampString as String exampString = "Name: John Smith Race: White" ect ect ect ect My code is now returning this Name John Smith Race White ................. continues till it gets to TPD# then does this TPD# summary text ...... and so on .... but the problem is not in the co as much as it is the strings it will be parsing most ar as above but a few will have a middle name to like Dim exampString As String exampString = "Name: Mary Jane Smith Race: White Sex: Female" and so on ....... If they didnt have the middle name my problem would be solved but the it is I may be going about this still all wrong though as what I am wanting to do is put it back together in an order like this Name: John Smith or John William Smith should a middle name exist Race: White Sex: Male Age: 45 continuing this on down to TPD# summary text ...... like that perhaps you guys could you point a better direction o what I might be overlooking all help is much appreciated vbMarkO ooops forgot to ad the code here it is Dim values As String values = "Name: Lanton Lamho Race: White Sex: Male Age: 18 DOB: 05-10-90 Height: 5’06 Weight: 152 Hair: Blk Eyes: Brown TPD#Lanton Lamho broke into the Quickie Mart located at 5310 S. Peoria Ave. The suspect used a manhole cover to throw..." Dim myString As String() = Nothing Dim sep(3) As Char sep(0) = ": " sep(1) = " Race:" sep(2) = " DOB:" myString = values.Split(sep, 29) Dim s As String Dim sArr As New ArrayList For Each s In myString sArr.Add(s).ToString.Replace(" ", ",") Next s For i = 0 To sArr.Count - 1 If sArr(i) = "" Then Else rtb1.Text = rtb1.Text & sArr(i).ToString.Trim(" ") & vbCrLf End If Next
  13. VB 2008 Express :)
  14. Ok here is what I am trying to do first the contents of the string I have an array that has forty or more of the following each element of the array contains data like this I need to parse Name: Lanton Lamho Race: White Sex: Male Age: 18 DOB: 05-10-90 Height: 5�06 Weight: 152 Hair: Blk Eyes: Brown TPD#Lanton Lamho broke into the Quickie Mart located at 5310 S. Peoria Ave. The suspect used a manhole cover to throw... NOTE!!!!!! Some of the names are first middle last not just first and last Anyway I need I need descriptions in labels and info in other labels like this Name: John Smith Race: White Sex: Male Age: 25 ect ect until it gets to the TPD# I need that stripped and all following put into a label of its own ie; Guy did what ever he did and he is in trouble for it LOL anyway .... I tried a multiple delimiter spit but the results left empty elements of the array .... Anyone got some ideas how I might best parse this? Heres the code I used and tried to modify but it wont work exactly right Dim values As String values = "Name: John Smith Race: White DOB: 1/22/60" Dim sites As String() = Nothing Dim sep(3) As Char sep(0) = ": " sep(1) = " Race:" sep(2) = " DOB:" sites = values.Split(sep, 9) Dim s As String For Each s In sites rtb1.Text = rtb1.Text & s.Trim(" ") & vbCrLf Next s Help much appreciated Mark
  15. This code is almost perfect but it does have one problem but then that might be my fault as you wrote it to search what I put in my array example I tested it and it found 7900 which in the example is correct its closest but put two numbers that are just as close then it chooses only one I added another number I put 7600 in and changed the 7900 to 7800 the code returned 7800 as closest but in fact the 2 are the same distance away .. Ok now let me share what it is I am doing and why ..... I am writing a program that monitors all the police calls iin my area. In fact that part is done and it works great .... the addresses of the calls are stripped and entered into arrays ... like the one I showed you there is a south array for the address containing IE; 7500 S ST, 8600 S another ST The other array is for East 1500 E you get it ST Anyway, I am highlighting in an RTB the calls that are within 2 miles of a specific address .... it is to assist us in keeping an eye on certain calls of conern in our area. So this is why ... thanx for the code by the way I will see if I can figure out how to get adresses that are closest and or also determine those that are equally as close. Mark
  16. Yes .... but then this is why I asked .. I am som how over looking the obvious ... I was sort of hoping somon might post an example .... just point me the way .. I mean I get it .... Here is the psuedo code or at least my thoughts myInt = "7700" Loop through array FOr Each item in array If item > myInt Then ' Then those that are greater than myInt ' subtract myInt from them ie; 8700 - 7700 = 1000 and 8800 - 7700 ' = 1100 or finally 9700 - 7700 = 2000 ' Then somehow compare the results to determine which of the items ' that are greater are closest ' Then do the same to the other side except this time subtract ' those items in the array that are less than myInt from myInt ' ie; 7700 - 6700 = 1000 an so on ' Then compare the results of each side as to which are closest 'OK as you can see I got an idea but I know I am going way off base here I can feel it I am simply ovrlooking the obvious or the simple solution Also I am wanting as I said to list the 1st closest to the 3rd closest but what happens if 2 are the same distance away???? Next Help is apreciated
  17. I want to do 3 things Dim myArr() As String = {"6200", "6600", "7900", "8600", "9900"} myInt = "7700" 1 .How do I determine which integer in myArr is closest to myInt 2. Next Closest 3. Next closest First closest txt1. text = myArr(i) & " 1st in line" 2nd txt2.text = myArr(i) & " 2nd in line" 3rd txt3.text = myArr(i) & " 3rd in line" I gave an attempt at this but I am embarrassed to show it as it didnt work and it was terrible Any help is much appreciated vbMarkO
  18. You pointed the way ... it was the array ... I needed to clear it first as when I was updating it was adding the info back into the array so the rtb was clearing as it should Thanx so very much THIS IS RESOLVED myPuAr.CLear() myLocAr.Clear() did the trick Thanx
  19. I know I know ... this sounds stupid ... But this RTB is about to drive me nuts I have contents of an array in the rtb and I need to clear whast in the rtb so I can update it with new content but what I am getting is this lets say I have 1 2 3 I have the above for example displayed in rtb when I update the rtb I get this 1 2 3 1 2 3 Its not clearing the other text before adding evn though I am telling it to Her is my code ' Why doesnt rtbDes.text = "" get it done??????? rtbDes.Text = "" For i As Integer = 0 To myPubAr.Count - 1 rtbDes.Text = rtbDes.Text & myPubAr(i) & "..........." & myLocAr(i) & vbCrLf Next I know this has got to be simple ... if I do this in lets say a listbox I can easily clear it an give it the update ... why not this stupid RTB? ALL help very much appreciated vbMarkO
  20. I am taking a different approach here and I am not sure I can do this SInce I cant seem to figure out how to parse this web page http://www.cityoftulsa.org/divisions/divisions.aspx?div=udsw and strip the info I need from it I am looking for an alternative and thats just giving in and just display it in a webbrowser control However, I dont wish to just display the whole page If you would look at the page you will see a table appear with info .... I want to just show the table not all the white around the table does that make sense? Ok I'm not finished ..... please note that this page already refreshes itself every 60 seconds ... big woo right ... well the table can grow ... in other words sometimes there may be 3 calls listed while other times 10 or more listed so I know that my container or web browser control will need to be able to expand at the bottom NOw as far as code I know how to navigate the we browser to the page just not sure how to only display the table and then how to also make it expand as the table expands Any thoughts .... appreciated vbMarkO
  21. Need help guys as this one is kicking my rear ... I am sure I am simply over looking whats in front of me but hey ... I am here now asking for insight Here is my result of the Rss.xml sorry its so much OOOPS it said it was to much ... so the link below in the code will take you to xml so you can see what I am up against ... I fear if I dont show the whole thing I might leave out something important. Info I am needing is found within each of these blocks <content type="xhtml" xml:lang="en-US" xml:base="http://tpdblog.typepad.com/most_wanted/"> <div xmlns="http://www.w3.org/1999/xhtml"> <p> <strong>Name:</strong> Ronald James Bodine<a href="http://tpdblog.typepad.com/.a/6a00d83451c5bd69e2010536bfad74970b-pi" style="FLOAT: right"> <img alt="Bodine_Ronald" class="at-xid-6a00d83451c5bd69e2010536bfad74970b" src="http://tpdblog.typepad.com/.a/6a00d83451c5bd69e2010536bfad74970b-320wi" style="MARGIN: 0px 0px 5px 5px" /> </a> <br /> <br /> <strong>Race:</strong> White <br /> <strong>Sex:</strong> Male <br /> <strong>Age:</strong> 49 <br /> <strong>DOB:</strong> 10-19-59 <br /> <strong>Height:</strong> 5�10 <br /> <strong>Weight:</strong> 150 <br /> <strong>Hair:</strong> Gry <br /> <strong>Eyes:</strong> Hazel <br /> <strong>TPD#</strong> 150248<br /><br />Ronald Bodine is wanted out of Tulsa County for Possession of a Controlled Drug and Burglary of an Automobile. Bodine�s bond is $350,000. Bodine last know address is in the 8000 block of South 87th East Ave.<br /> </p> </div> </content> I cleaned this one up a bit so it will make a little more sense ... Anyway, I need to parse this ... I have tried several ways and for some reason I can not figure out how to get to the content ... I feel like such a noob <---- forgive that .... as I know we all see this alot but... I used to do this stuff in my sleep .. Its been several years since I have been in this and I cant beleive how much I forgot ... ok enough with the crying .... Ok ... would it be possible for someone to just help me a bit in how I can parse this so I can get at the info within the above example I need to access 1. the img as located in this url href="http://tpdblog.typepad.com/.a/6a00d83451c5bd69e2010536bfad74970b-pi 2. then the info between the <strongs> ie; Race: White Sex: Male and such like ..... I used xmlDocument to load the xml into a doc such as Dim doc As New XmlDocument() doc.Load("http://tpdblog.typepad.com/most_wanted/rss.xml") From there I tried many variations of what I thought was the right way only to hit a dead end ... Anyone please point me right here help me get back in the groove please and remind my brain how to parse the doc once I have it loaded All help appreciated .... vbMarkO
  22. MrPaul, I am looking at the third party driver and also found CR has a driver too ... but then I know nothing of how to go about using a driver .... I looked at the setup of a driver on CR site and it to me is complex enough that it might be easier to consider either learning to create a relational Database as you mentioned and write my program to work with it or to try converting ... Since my app is written, I would like to explore converting to a relational model ... Could you point me to any examples of how I might go about doing just that? vbMarkO
  23. I have an application of which I would like to be able to generate a report of certain data contained in my xml file. I have never used Crystal Reports before .... and from what I can see of most tutorials they use Database files to bind to the report .... I haven't found any tutorial or example that uses what I have .... an application with textboxes which the info entered is saved to an xml file. I want to display that info as a report ..... I am using vs2005 ..... Anyone point me int he right direction ... or provide an example .... I am willing to provide more detailed info if needed such as the xml structure or what ever else you might need ... I am a hard worker, I learn fast but, just need a good starter example of how I might can make this work. vbMarkO
  24. Im sorry I guess I should of stated I dont do C# I might be able to convert it but then IM not sure here as I get turned around when it comes to C# VbMarkO
  25. I wasn't sure where else to put this question.... Here is what I am wanting to do. I have a Blog feed of which I am wanting to read ..... Here is how this blog works... its an artist blog... I'm the artist.... I am wanting to read the xml feed at http://mbstudiosdailypaintings.blogspot.com/atom.xml and within each post on the blog is a image ... I am wanting to get the image and add it to a gallery to be viewed on a web page. So each new image automatically add it to the gallery. vbMarkO
×
×
  • Create New...