Hi Jo 2,

I've just spotted this, and thought I'd point out a much simpler way of doing this

'Load your image file, essentially locking access to it
Dim BMP As Bitmap = Bitmap.FromFile("C:\Users\Jay\Desktop\test.jpg")

'When assigning to your picture box, create a new bitmap
PictureBox1.Image = New Bitmap(BMP)

'Dispose of the original bitmap, freeing up access to the file

'Speed up garbage collection, releasing your file.

I hope this helps.


Thanks for that little insite kplcjl... I shall bear that in mind for next time....

Did you like what I did there... bear... grrrrrrrr lol

Surrounded by people who are quite technically minded yet a person's nationality is determined by the colour of their profile picture as opposed to actually checking out a profile.

I wonder where I'd be from if I set it to a green hue... Ireland maybe.

If only so much thought and attention had been put into constructively criticising the source provided. It's kind of handy though because the TEFAL website I'm enrolled in keeps giving coding advice... weird?

Alas... I'm being rude...


I was wondering if there was an existing method within the .Net frame work which will copy every nth element of an array to a differant array with an initial offset e.g.

Original Source Array (Bytes)

Original Target Array

Source Offset 1
Source Step 3

Target Offset 3

Updated Target Array

I can quite easily do this with a loop, however it would be handy if a method existed which performed this operation. Primerily the array is a single dimensioned byte array.


I'm just a kind of in awe. Just popping onto a site like DaniWeb, you seem to forget that there might have actually been some hard work involved, tears, frustration and all host of mixed emotions. You forget that Dani isn't just a binary baby born from the loins of a floppy drive but actually started out with an idea, a pretty hairy design and then worked her ass off, no doubt with the support of friends and the community to mature a grow the site to what it is today.

It's been a massive eye opener for myself, just a quick snapshot of Dani's work the historic screen dumps of DaniWeb has completely al;tered my perspective on a couple of things. 1. What can really be achieved through hard work and actually giving a shit about what you are doing, and 2. The individuals behind sites like this aren't just fat cats with dollar signs in their eyes, their real people, with real dreams, and real goals.

I keep talking about Dani in the third person, I know you're reading this Dani, I'm afraid I just don't know how to wriute this without talking about you and to you at the same time.

Regardless, I just want to say I'm respectfully proud of you, and what you've done, and I'm infinatly grateful to you for providing us with this pretty kick ass service.

...And no I'm not forgetting all the Mods, Admins and the community it's self, every one ...

Votes + Comments
Thanks so much!

Oh my god... I must be smoking crack... Somehow I always thought this was the bottom of the page


But look, there's even more BWahahahaha...


I swear to god I've never seen that bit what the hell man... look there's a little JC badge too whoop... I must of just assumed the dim gray box was the footer and stopped scrolling automatically. GOSH DARN IT.

Re-Write blowfish for .Net:1
Navigate Web Browser:0


Hi Dani, thanks, I managed to get help understanding that. What I am really trying to find is the following. Once I've clicked on "publish" i Get this screen with the link at the top "View Article Workshop"


Then when I click on the link I get the list of pending and draft articles:


as you designed and built the website you'll be all to familiar with this =0) however, my question really is, once I've left this page, how do I get back to this Article Workshop View list, If I save a draft I can't seem to figure out how to get back to it at a later date... also, like here I've created a bunch of tests... which would be kind of cool if I could just click on a littel trashcan or something to delete them.


First of all I'd like to say great work on the addition of drafting articles before commiting to editorial however one question. The last two samples I published (Removed tick from "This is a working draft") seems to make the pending article unaccessible, I recently found out that the articles had been submitted for checking which is cool, however I couldn't find them any where, to get access to these articles I had to create a new article, then save as draft wich gave me access to a list of draft and pending publishing articles.

Is there a way to access this Draft\Pending list to re-edit at a later date, if so where it it. I think the link i saw was something like "upcoming articles"



Assuming you are passing the same instance of stream to each of your Addxxx methods then yes it should work. However I think you need to do this using (CryptoStream crStream = new CryptoStream(stream, cryptic.CreateEncryptor(), CryptoStreamMode.Write)) only once at the start of the entire write process for all of your methods, not in each method.


The File.OpenRead, is as you have pointed out locking the file access mode to read only, you should probaly just use Open, which is read\write.

When writing your stream, the position within the stream doesn't seem to have changed position, so any writing will occour from the first byte, overwriting exiting data.

However, looking at this it doesn't look like your file will have any pointer references each time you append data to your file. A new crypto stream will be written each time you write to the file, or indeed append the file however you will end up with a whole bunch of encrypted data chunks, with no reference in length for each one.

I would assume you would have to read all the data of the file, decode it, append the new data, encode it again then rewrite the files contents as a whole.


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.


Ok, Let's assume the following table:


And the following code in your Form1 class:

        SqlConnection sqlCon;
        SqlCommand sqlCmd;
        String conString = "Server=SOLVOTERRA-HP;Database=Birthdays;
            Integrated Security=true";

        DataTable dTable;

        //DGV Cell Content Clicked Event
        private void dataGridView1_CellContentClick(object sender, 
            DataGridViewCellEventArgs e)

            //Clear Previous Binding

            //Reset New Binding
                dataGridView1.DataSource, "Birthday");


        public Form1()

            //Create New Connection
            sqlCon = new SqlConnection(conString);

            //Create New Command
            sqlCmd = new SqlCommand("SELECT * FROM Person", sqlCon);

            //Create New Data Adapter
            SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(sqlCmd);

            dTable = new DataTable();
            dTable.TableName = "Results";

            //Fill The Table With Your Data

            //Close The Connection

            //Set The DGV's Data Source To The Table
            dataGridView1.DataSource = dTable;


Even though the date time stap formats don't match this wont raise an exception, in fact clicking on the row will update the DTP's value:


As the DTV is bound to the DGV, updating the DTP's value will also update the DGV. Though this wont effect your database directly.



Oh No, not another LockBits demo. Well hopefully this demo may also give you a little in site into actually playing with, and calculating some simple effects as well as understanding the advantages of LockBits as apposed to GetPixel and SetPixel.

A Useful Note.

It is important to note that using LockBits is only effective beyond a certain point. Bench tests show that if you manipulate below roughly 60 to 70 pixels in one go, you are in fact better off using GetPixel and SetPixel. Why? Well basically the time allowed for locking bits and unlocking bits, as well as copying all the byte information needs to be considered when making these calculations. Much below 60 or 70 pixels, this time taken exceeds the time taken to simply use Get or Set Pixel.

This can be explained in more detail Here

So What Do We Have Here Then?

  1. Wrapping up Lockbits and associated methods into a more manageble class.
  2. Applying Filter effects to your images.
  3. Playing with the Alpha Channel.
  4. Mimicing Opacity.
  5. Overlaying Images (Layering).

Below you can see the interface which will allow you to manipulate the images, quickly in real time:

** The left hand image, and sliders will allow you to manipulate the saturation of each colour channel in the image, essentially removing a colour from an image.

** The center image shows the left image combined with the right hand image. This image doesnt relay ...

Votes + Comments
Nice tutorial

=======Download The Full Solution Below========

This will be my last VB.Net soure as I've made the move to C#. For a recent job application I was given the technical test to create a horse race simulator which would calculate the odds of a runner winning a race of up to 16 runners, then ensure the runners were within a 2% winning margin of there expected win percentage after 1,000,000 races. I got the results between 0.10% and 0.02% but never got offered the position as my solution was "Beyond Requirements".


This solution is host to ll sorts of goodies including multithreading, basic user controls etc... further more, if you bet on the horses this may be great for you.


=======Download The Full Solution Below========