J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

Also, GoTo exits the loop meaning the conditions within that particular loop will only ever be true once. I can see that this is in another loop but it's not clear from here what for.

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

Wow, I didn't know GoTo was still valid, please stop that.

Well first of all, the flow of this entire operation is a little shaky, however looking at this:

                If LVProduct.Items(w).SubItems(4).Text = LVProduct.Items(w).SubItems(5).Text Then
                    GoTo Here
                End If
                If LVProduct.Items(w).SubItems(4).Text = LVProduct.Items(w).SubItems(5).Text Then
                    GoTo there
                End If

Both conditions are exactly the same so if the conditions are correct it will always goto Here, and never there.

in fact GoTo there will never be called, Here seems to be where your Whole sale stuff is... Wholesale is always going to be called if the above conditions are correct.

Also not understanding what your check boxes are doing and when, there is a chance when you GoTo Here, there's code will be executed afterwards.

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

Bugger. That's beyond my knowledge I'm afraid. Maybe you could post that response in web development and ask about security within iFrames. I think the VB side is ok.

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

Ok, this is going to hit every <a> tag in the iframe with invoke onclick, but give it a shot

 Dim theElementCollection3 As Windows.Forms.HtmlElementCollection

 'This line now includes access to the iFrame document.
 theElementCollection3 = WebBrowser1.Document.Window.Frames(0).Document.GetElementsByTagName("a")

 For Each Element As HtmlElement In theElementCollection3
     Element.InvokeMember("onClick")
 Next

if there's more than one frame try changing the Frames(0) to another index. if the index is wrong you will get an error.

I got this to work on a quick demo I made here.

http://software.solvoterra.com/example2.html

example2.html has an iframe whose source is sameURL/example.html

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

If this is your own HTML source you can give the <a> tag an id. in this case "Test" then use the following code.

Dim theElementCollection3 As Windows.Forms.HtmlElement

theElementCollection3 = WebBrowser1.Document.GetElementById("Test")

theElementCollection3.InvokeMember("onClick")

The <a> tag looks like this

<a id="Test" href="javascript:void(0)" onClick="removeOverlayHTML()">
<img style="position:absolute;top:97px;left:290px;border:0;z-index:101;width:10px;height:10px" src="http://www.castup.tv/images/close_button.png" alt="x"/></a>
J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

I'm not 100% but wouldn't you need to invoke the "onClick" member?

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

ddanbe has provided two great examples of reading the Excel sheets. And This Link directly from IBM shows you how to parse a DataTable into DB2 it's in C# but easy enough to translate.

Job Done =0)

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

Could you not parse the spreadsheet via a DataTable first? SpreadSheet -> DataTable -> DB2

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

If thae parsing fails, you wont have any results so trying to access MyResults.Results(0) will "result" in an error as a result object hasn't been added to the results list.

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

Ok, the first part of the structure is ok, so here's the Geometry bit:

The Complete Code Is At The End

In geometry you have a few properties, let's make a simple textified version:

-bounds
--northeast
---lat
---lng
--southwest
---lat
---lng
-location
--lat
--lng
-location_type
-viewport
--northeast
---lat
---lng
--southwest
---lat
---lng

From the above structure you can see there are a couple of properties, some of which the structure is repeated. so the base structure for geometry would have the following properties

bounds
location
location_type
viewport

viewport and bounds have the same sub properties

northeast
southwest

and those sub properties, as well as location have sub properties

lat
lng

so create a LatLong Object

Public Class LatLong
    Public Property lat As String
    Public Property lng As String
End Class

New we'll create a Coords object for northeast, southwest

Public Class Coords
    Public Property northeast As LatLong
    Public Property southwest As LatLong
End Class

and the actual GeometryData object

Public Class GeometryData
    Public Property bounds As Coords
    Public Property location As LatLong
    Public Property location_type As String
    Public Property viewport As Coords
End Class
Object Structure

So your complete structure now looks like this

Public Class MyResults
    Public Sub New()
        results = New List(Of Result)
    End Sub
    Public Property results As List(Of Result)
    Public Property status As String
End Class

Public Class Result

    Public Sub New()
        address_components = New List(Of AddressComponents)
        types = …
J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

Of course you can. Am I right in assuming that you've got a good idea of what's going on, you're just having difficulty in matching the structure? I'll keep my eyes on this thread and have a look into this whilst waiti9ng for your response.

Just out of interest, do you have your current effort available to post so I can also see if you're not to far away from your solution?

BAre with me, I'll have a play in the mean time.

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

You're welcome. I hoped it's helped.

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster
Sorry, I'll try that again...

-------

Looking at your provided JSON string it looks like the property name is long_name >"long_name" : "Sunderland"

for example, if you set your structure up correctly you would access it by the following

Dim Town as string = MyResults.results(0).address_components(1).long_name

If you have trouble with this I will be happy to provide you with further assistance.

to get you started you would begin with the follwoing structure

Your base class may look something like this:

Private class MyResults
     Public Sub New()
        results = New List(Of Result)
    End Sub
    Public property results As List(Of Result)
    Public property status As String
End Class

Your Result class may look like this

Private Class Result
    Public Sub New()
        address_components = New List(Of AddressComponents)
        types = New List(Of String)
        geometry = New GeometryData
    End Sub
    Public property address_components As List(Of AddressComponents)
    Public property formatted_address As String
    Public property geometry As GemoetryData
    Public property partial_match As Boolean
    Public property types As List(Of String)
End Class

Your AddressComponents object may look like this:

Private Class AddressComponents
    Public Sub New()
        types = New List(Of String)
    End Sub
    Public property long_name As String
    Public property short_name As String
    Public property types As List(Of String)
End Class

Do you see how you're building an object structure to match the structure of the JSON string. The geometry class would be a little more complicated, but the same principal.

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

Looking at your provided JSON string it looks like the property name is long_name >"long_name" : "Sunderland"

for example, if you set your structure up correctly you would access it by the following

Dim Town as string = results.address_components(1).long_name

If you have trouble with this I will be happy to provide you with further assistance.

to get you started you would begin with the follwoing structure

Your base class may look something like this:

Private class MyResults
    Public results As List(Of Results)
    Public status As String
End Class

Private Class Results

    Public address_components As List(Of AddressComponents)
    Public formatted_address As String
    Public geometry As objGemoetry

End Class

Your AddressComponent object may look like this:

Private Class AddressComponents
    Public long_name As String
    Public short_name As String
    Public types As List(Of String)
End Class

Do you see how you're building an object structure to match the structure of the JSON string. The geometry class would be a little more complicated, but the same principal.

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

I just don't get this one Jim, apart from a whole bunch of un-needed code... batoolhussain's, yours, and even:

        Dim pic As Bitmap = New Bitmap(PictureBox1.Image)
        Dim gray = New Bitmap(pic.Width, pic.Height)

        For x As Integer = 0 To (pic.Width) - 1
            For y As Integer = 0 To (pic.Height) - 1
                Dim c As Color = pic.GetPixel(x, y)
                Dim d As Integer = (CInt(c.R) + CInt(c.G) + CInt(c.B)) \ 3
                gray.SetPixel(x, y, Color.FromArgb(d, d, d))
            Next
        Next

        PictureBox2.Image = gray

Should all work. I can only assume there's a dodgy property somewhere?

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

There is no reason why this code shouldn't work. To speed things up a little move PictureBox2.Image = gray outside of the two for-next loops.

try creating a new form, with a picturebox (Change no properties) and the button. place the code in the button and load an image into the picture box's image property and try running again.

I've just copied and pasted your code into the above scenario and it works.

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

Though instead of typing out all those properties like that just for a couple of bits of data you may just want to structure your properties like this

Public Property bytes As Long
Public Property is_dir As Boolean

etc

Note The property name and the object structure has to match the JSON names and structure.

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

Have you tried parsing the JSON into an object structurte? here is a JSON string from a DropBox list files Query:

{"hash": "2e50103f8605f7639f7da0fd2e934fe4", "thumb_exists": false, "bytes": 0, "path": "/", "is_dir": true, "icon": "folder", "root": "app_folder", "contents": [{"rev": "5929d57df1", "thumb_exists": true, "path": "/flower.jpg", "is_dir": false, "client_mtime": "Mon, 15 Sep 2014 19:20:02 +0000", "icon": "page_white_picture", "bytes": 879395, "modified": "Mon, 15 Sep 2014 19:20:01 +0000", "size": "858.8 KB", "root": "app_folder", "mime_type": "image/jpeg", "revision": 89}, {"rev": "829d57df1", "thumb_exists": false, "path": "/test.xlsx", "is_dir": false, "client_mtime": "Mon, 08 Sep 2014 12:50:47 +0000", "icon": "page_white_excel", "bytes": 21699, "modified": "Mon, 08 Sep 2014 12:50:47 +0000", "size": "21.2 KB", "root": "app_folder", "mime_type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "revision": 8}], "size": "0 bytes"}

A bit of a mess like this. However once you've determind the structure you can create an object structure like this

 Public Class dbFiles

        Private _contents As List(Of dbFile)
        Public Property contents As List(Of dbFile)
            Get
                Return _contents
            End Get
            Set(value As List(Of dbFile))
                _contents = value
            End Set
        End Property

        Private _hash As String
        Public Property hash As String
            Get
                Return _hash
            End Get
            Set(value As String)
                _hash = value
            End Set
        End Property

        Private _thumb_exists As Boolean
        Public Property thumb_exists As Boolean
            Get
                Return _thumb_exists
            End Get
            Set(value As Boolean)
                _thumb_exists = value
            End Set
        End Property

        Private _bytes As Long
        Public Property bytes As Long
            Get
                Return _bytes
            End Get
            Set(value As Long)
                _bytes = value
            End Set
        End Property

        Private _is_dir As Boolean
        Public Property is_dir As Boolean
            Get
                Return _is_dir
            End Get …
J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

Have you seen this?

Click Here

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

OK, here's the basic solution that you wanted. I have included 2 Methods. Each method provides the same results, but one is timed using a Timer (Method 2) and the other is a simple Do - Loop (Method 1).

I've included the Do-Loop so you have all the code you need in one place, however it will lock up your form.

To copy and paste this code directly you need to add a label and two buttons to your form.

Public Class Form1

    '#####################################Solution Objects
    'The Timer Object That Will Provide
    'You With A Tick
    Private ClockTimer As Timer

    'Your Clock Object That will hold the time
    Private Clock As DateTime

    'The End Time
    Private EndTime As DateTime

    'Hands Over Counter
    Private HandsOverCount As Int16
    '##################################END SOLUTION OBJECTS


    '###################THIS CODE NOT NEEDED FOR METHOD 1
    Private Sub Form1_Load(sender As Object, e As EventArgs) _
    Handles MyBase.Load

        'Initiate A New Timer
        ClockTimer = New Timer

        'Add A Handler For The Tick Event
        'Every Time The Timer Ticks It Calls the "ClockTick" Routine
        AddHandler ClockTimer.Tick, AddressOf ClockTick

    End Sub
    '###################END THIS CODE NOT NEEDED FOR METHOD 1

    '###################################METHOD 1
    'Start The Simple Do-Loop Example
    Private Sub Button2_Click(sender As Object, e As EventArgs) _
    Handles Button2.Click

        SelfContainedSample()

    End Sub

    'This is a standalone version in a loop. It will give you
    'the same results as the example above but all the elements you need
    'are in one place. Rmember though, running this directly will lock
    'up your windows form until completion.
    Private …
J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

Ok. Though thinking about it there is only 11. 12:00 is the start point 11:59 is the end point there are 60 minutes in an hour but they go from 0 to 59. 0 can't be the start and end of the same hour otherwise therd be 61 minutes in an hour.

I'll have the solution for yoy in a few hours.

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

Sorry its 12 if you count the the stary and end podition. Its only 11 if you dont count the start position.

Ignore previous post about it 13

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

Ok so starting at 12 isn't being counted as hands over each other... i suppose if you start at 12 and end at 12 technically they're over each other 13 times. Im sorry but 11 just isnt right, you'd have to start at 12:01 and end at 11:59 for 11 counts.

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

Is this for a school project? If it is I'll provide you with the solution but make it into a kind of tutorial to help you understand exactly whats going on. I'll provide you with a much more basic graphical representation too if you like.

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

Make sure though, if you are using Now, you covert the 24hr hour to a 12hr hour.

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

Ok. Well if your not too fussed about the accuracy of the physical hands you could simply do

If Now.Minute = Now.Hour x 5 then OverCounter +=1

This is basically iterating every time the minute hand goes over the specific hour segment of the clock. This could be made even more accurate by only incrementing when the minute hand is on the same 60th segment as the hour hand or even more accurate over the same 360th segment.

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

Note: this isn't the most effective way to draw on to the form, just a quick example.

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

do you mean a clock that counts every time the minute hand is over the hour hand?

if so... your answer should actually be 12

Any way, just for a giggle. Here's some classic clock maths. Copy and paste this code into your form. The forms title will count the number of times the second hand goes over the minute hand. The minute hand and hour hand sweep. If you want the second hand to sweep you'll need to pass milliseconds. I've used variables instead of just equations so you can hopefully get an idea of whats going on.

Just to save even more time. to do what I think you want to do... All you need to do is increment your HandOverCounter every time the second = minute or minute = hour depending on which hand over hand you want to count.

Public Class Form1

    Dim tmr As Timer
    Dim B As Bitmap
    Dim TickOver As Integer

    Private Sub Form1_Load(sender As Object, e As EventArgs) _
    Handles MyBase.Load

        tmr = New Timer
        tmr.Interval = 1000

        AddHandler tmr.Tick, AddressOf DrawClock

        tmr.Start()
    End Sub

    Private Sub DrawClock(sender As Object, e As EventArgs)

        DrawHands(Now.Hour, Now.Minute, Now.Second)

    End Sub

    Private Sub DrawHands(HourVal As Single, MinuteVal As Single, _
    SecondVal As Single)


        Dim Pi As Single
        Dim X As Single
        Dim Y As Single

        Dim SecondAngle As Long
        Dim MinuteAngle As Long
        Dim HourAngle As Long

        'This simply increments when the second hand is over _
        the minute hand
        If SecondVal = MinuteVal …
J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

Now tha't some damn fine news... I feel it necassary to quote the out here brothers.."Whoomp! there it is" lol

Please post an image of the in-game graphic at work.

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

Ok, that was scary. Here is the correct version

Deep Modi commented: Amazing, You are the one that You are giving the great efforts on my projects, AMAZING Talent... GOOD JOB +4
J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

\No dont... somethings happening here

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

OMG... it didn't save AHHHHHHHHHHHHHHHHHHHHHHHHHH....

just pulling the recover info, hold on

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

Ok, here's 1.1 I'm glad to see the tests work on your game. I have figured out if you use "{" before the inner file name it will render transparent pixels eg "{LOGO" if you just use "LOGO" the entire texture will be solid.

0816e2be0a7a5252d0f904e9eab437a5

I've updated my program with the updated Write method, a transparency chack box, and a palette viewer.

If you want to use your DEEP MODI texture, I figure you need to render the file with transparency unchecked.

Deep Modi commented: Great Job, Salute to you +0
J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

No worries, I'll get your filoes and have a play over the next day or so

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

Max length you can ignore that, it's the internal file length that's max 16 not the WAD name. TODO: Check image file name (not including .Extension) is <= 16 bytes.

You need both WAD and Edit as my class uses the WAD structures

Please tell me you can follow code to where the images are checked... I've even commented it all for you. If your planning on just using this code without attempting to learn from it, it's kind of dissapointing.

To answer your question... what is the first method the button calls... Editor.CreateWADFile... maybe you should check there.

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

Ok, this should be it. I uploaded the corect file but I used the same file name so...

Hopefully this should be it. Let me know... and please let's get this solverd lol

Deep Modi commented: Thanks for Attachment +4
J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

Lol

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

Dude ive just written you a bit crunching program... why are you telling me how to set file attributes lol

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

Yeah. It's all included in the program. Don't worrt about it bud

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

Lol. Thanks, a bit late now as I had to research it but still... useful.

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

Cant believe its the wrong zip. I'll upload when home.

Pre-check ensures basic things like correct image dimensions, prevent overwrite existing wad, image file exists etc

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

Here you go, The complete solution. I've included a sample image with the correct dimensions etc (Multiples of 16) and a sample wad file to extract.

a2a51b2a0f14b66065888044384d6c14

I hope this works for you. Remember... Images dimensions X\Y MUST BE MULTIPLES OF 16. i've included a pre check option to help.

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

I've done it.... Just re-factoring and commenting.

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

You mean, all you want to do is create a new WAD file, not update an existing one?

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

@Deep Modi... Can you send me your WAD file, the one im using is limited to a 256 colour palette. I want to see what the one you are using is. I refuse to believe a modern game is using 256 colour textures.

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

MipMaps.

My interpretation. MipMaps as a collection of pre-rendered images to save processing time (Furher away textures have less pixels to process) and reduce the effects of antialiasing. Each MipMap contains several images from full size down to really small. The 3d enine will select which texture (Images in MipMaps are textures) to apply to the surface depending on the mathmatical distance from the user. In a wad3 file there are four images 1 1\4 1\16 and 1\64. this tells me that the furthest away texture will be resized to a maximum of 1\32 and minimum of 0. When scaling up (getting closer) the software will switch the texture at 1\32 to the second smallest image and resize it from smallest 1\32 passed it's pre-rendered size at 1\16 to an elargement of 1\8 and so on.

http://en.wikipedia.org/wiki/Mipmap

Indexed Images,
Files such as PNG can use and indexed palette, typically up to 256 colours. Unlike a bitmap where the RGB values are written in the byte order they appear, each byte in an indexed PNG holds the index reference to the palette and the color stored within. The palette can be various formats including RGB and ARGB. It seems WAD3 files use this method though much of the PNG's meta headers are removed leaving only the meta values, the image data and the palette information.

Here's more information about indexed images

http://en.wikipedia.org/wiki/Indexed_color

Ok, so over to the code in the zip file

        'Read the …
J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

@Deep Modi I thought you would have tried to run the console program, or read my alterations. After you ran my version and you selected your WAD file, the program should have created an "Output" directory in your My Documents folder and extracted all the images. Can you confirm you have the Output folder in your My Documents and can you confirm there are images in the folder. In fact my version should automatically open the Output directory for you.

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

Mr. M to be fair the console app only reads the data, it doesn't write or rearrange the contents. Though the console program does (should) give all the clues how to achieve this.

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

When i get home I'll explain in much more detail what is happening and why you need to stop using the phrase "convert bmp etc to WAD file". Note: a wad file is more like a cab or zip (without the compression) containing textures that are of indexed palette. I know this because i not only researched mips last night but i also inspected the code you ptovided in the zip.

J.C. SolvoTerra 109 Eat, Sleep, Code, Repeat Featured Poster

Deep Modi. This isn't my solution. This zip is only your zip converted to WinForms instead of console which you complained about. Listen bud, if you can't understand the code in this program then I'm sorry to point out that thus project may be way over your head... to be polite of course.

I will finish my solution for you which will allow you to overwrite a mip entry based on the original dimensions and palette size.

After that i suggest you study mip files, textures etc like i did last night and try to get a better understanding of what you are trying to do.

Respectfully.
Jay