Will Diablo III ever get published.

Monday, 14 January 2008 10:19 by Frimbob

There is that feeling in the air again, blizzard has announed a secret project with the with the ever-present 'comming soon' lable on their website.

What could it be is the big question in the eyes of gammers every where?

Daiblo 2 released back in 2000 continues today to retain a core group of fanatical players, with the sucess of World of Warcraft tunring many  users of Blizzard's free Battle.net service into walking subscriber cash cows, will Blizzard attempt to bring the others into the fold. Will the new game be a Daiblo MMO? While Blizzard maintains its strangle hold on the fantasy MMOG will it attempt another.

With starcraft 2 in developemt would a partner Sci-fi Starcraft MMO be a better option. Surely in another 2 years WOW will show higher rates of subscriber Churn. I would very much welcome a polished sci-fi  alternative to world of warcraft, right now I am filling that gap with the Action RPG of Hellgate London, seen as many to be the spiritual successor of Diablo 2.

While I appricate the technical complexity of the engine the creaters of Hellgate have designed, the game to me still feels shallow. After 2 years as a wow suscriber, I crave depth in my games and hellgate does not provide this to me. If blizzard did ever come out with a diablo MMO I would certainly like to try it. 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags:   , ,
Categories:   Life and Stuff
Actions:   E-mail | Permalink | Comments (0) | Comment RSSRSS comment feed

A custom User Control - Photos

Saturday, 12 January 2008 07:19 by Frimbob

Overview: I was looking for the ability to print out a page of photos without having to mannualy create a page, to this end I have created a custom user control that will search a set folder at run-time for images under sub-directories, with each catagory being its own catagory.

The challange included.

  1. Methods to paraise the directories and a relation data-store
  2. Developing a function that would print each catagory, and the Correct relative Paths.
  3. Develop the HTML  that would allow an assingable number of photos on each line.
  4. CSS techniques to make them look good.

Part 1 -The Properties

[code:vb] </p> <font size="2"></font><font size="2">&lt;%<font size="2" color="#0000ff">@</font><font size="2"> </font><font size="2" color="#a31515">Control</font><font size="2"> </font><font size="2" color="#ff0000">Language</font><font size="2" color="#0000ff">=&quot;VB&quot;</font><font size="2"> </font><font size="2" color="#ff0000">ClassName</font><font size="2" color="#0000ff">=&quot;PhotoDisplay&quot;</font><font size="2"> %&gt; &lt;%<font size="2" color="#0000ff">@</font><font size="2"> </font><font size="2" color="#a31515">Import</font><font size="2"> </font><font size="2" color="#ff0000">Namespace</font><font size="2" color="#0000ff">=&quot;System.IO&quot;</font><font size="2"> %&gt; </font><font size="2"></font></font><font size="2"><font size="2">&lt;%<font size="2" color="#0000ff">@</font><font size="2"> </font><font size="2" color="#a31515">Import</font><font size="2"> </font><font size="2" color="#ff0000">Namespace</font><font size="2" color="#0000ff">=&quot;BlogEngine.Core&quot;</font><font size="2"> %&gt; </font><font size="2"> <p> &lt;%<font size="2" color="#0000ff">@</font><font size="2"> </font><font size="2" color="#a31515">Import</font><font size="2"> </font><font size="2" color="#ff0000">Namespace</font><font size="2" color="#0000ff">=&quot;System.Data&quot;</font><font size="2"> %&gt;</font> </p> </font></font></font></font><font size="2" color="#0000ff"> <p> &lt;<font size="2" color="#a31515">script</font><font size="2"> </font><font size="2" color="#ff0000">runat</font><font size="2" color="#0000ff">=&quot;server&quot;&gt;</font> </p> </font><font size="2"> <p> &nbsp; </p> <p> <font size="2" color="#008000">&#39;Image Folder Property</font> </p> </font><font size="2"> <p> <font size="2" color="#0000ff">Private</font><font size="2"> _imageFolderPath </font><font size="2" color="#0000ff">As</font><font size="2"> </font><font size="2" color="#0000ff">String</font><font size="2"> = </font><font size="2" color="#a31515">&quot;../pics/photos/&quot;</font> </p> </font><font size="2"><font size="2" color="#0000ff">Private</font><font size="2"> intItemsPerRow </font><font size="2" color="#0000ff">As</font><font size="2"> </font><font size="2" color="#0000ff">Integer</font><font size="2"> = 4 </font><font size="2"> <p> &nbsp; </p> <p> <font size="2" color="#0000ff">Public</font><font size="2"> </font><font size="2" color="#0000ff">Property</font><font size="2"> ItemsPerRow() </font><font size="2" color="#0000ff">As</font><font size="2"> </font><font size="2" color="#0000ff">Integer</font> </p> </font></font><font size="2"> <p> <font size="2" color="#0000ff">Get</font> </p> </font><font size="2"><font size="2" color="#0000ff">Return</font><font size="2"> intItemsPerRow </font><font size="2"><font size="2" color="#0000ff">End</font><font size="2"> </font><font size="2" color="#0000ff">get</font><font size="2"> <font size="2" color="#0000ff">Set</font><font size="2">(</font><font size="2" color="#0000ff">byVal</font><font size="2"> value </font><font size="2" color="#0000ff">AS</font><font size="2"> </font><font size="2" color="#0000ff">Integer</font><font size="2">) </font><font size="2"></font></font><font size="2"><font size="2"> <p> intItemsPerRow = value </p> <font size="2" color="#0000ff">End</font><font size="2"> </font><font size="2" color="#0000ff">Set</font><font size="2"> </font><font size="2"><font size="2" color="#0000ff">End</font><font size="2"> </font><font size="2" color="#0000ff">Property </font><font size="2" color="#0000ff"> <p> &nbsp; </p> </font></font></font></font></font></font><font size="2"> <p> <font size="2" color="#0000ff">Public</font><font size="2"> </font><font size="2" color="#0000ff">Property</font><font size="2"> ImageFolderPath() </font><font size="2" color="#0000ff">As</font><font size="2"> </font><font size="2" color="#0000ff">String</font> </p> </font><font size="2"> <p> <font size="2" color="#0000ff">Get</font> </p> </font><font size="2"><font size="2" color="#0000ff">Return</font><font size="2"> _imageFolderPath </font><font size="2"> <p> <font size="2" color="#0000ff">End</font><font size="2"> </font><font size="2" color="#0000ff">Get</font> </p> </font></font><font size="2"><font size="2" color="#0000ff">Set</font><font size="2">(</font><font size="2" color="#0000ff">ByVal</font><font size="2"> value </font><font size="2" color="#0000ff">As</font><font size="2"> </font><font size="2" color="#0000ff">String</font><font size="2">) </font><font size="2"> <p> _imageFolderPath = value </p> <p> <font size="2" color="#0000ff">End</font><font size="2"> </font><font size="2" color="#0000ff">Set</font> </p> </font></font><font size="2"> <p> <font size="2" color="#0000ff">End</font><font size="2"> </font><font size="2" color="#0000ff">Property</font> </p> </font> <p> [/code]

Nothing too Special Here 2 public properties that can be set on the tag, the first being the root folder for the images and the second the number of photos on each row. 

Part 2 - The Data Structures

[code:vb] </p> <font size="2" color="#0000ff"> <p> Private<font size="2"> </font><font size="2" color="#0000ff">Function</font><font size="2"> FolderListArray(</font><font size="2" color="#0000ff">ByVal</font><font size="2"> _imageFolderPath </font><font size="2" color="#0000ff">As</font><font size="2"> </font><font size="2" color="#0000ff">String</font><font size="2">) </font><font size="2" color="#0000ff">As</font><font size="2"> </font><font size="2" color="#0000ff">Object</font> </p> </font><font size="2"></font><font size="2" color="#0000ff">Dim</font><font size="2"> photoCollection </font><font size="2" color="#0000ff">As</font><font size="2"> </font><font size="2" color="#0000ff">New</font><font size="2"> NameValueCollection</font><font size="2"> <p> <font size="2" color="#0000ff">Dim</font><font size="2"> j </font><font size="2" color="#0000ff">As</font><font size="2"> </font><font size="2" color="#0000ff">Integer</font> </p> </font><font size="2"> <p> <font size="2" color="#0000ff">Dim</font><font size="2"> aryChildFolder() </font><font size="2" color="#0000ff">As</font><font size="2"> </font><font size="2" color="#0000ff">String</font> </p> </font><font size="2"> <p> <font size="2" color="#0000ff">Dim</font><font size="2"> strFileName </font><font size="2" color="#0000ff">As</font><font size="2"> </font><font size="2" color="#0000ff">String</font> </p> </font><font size="2"> <p> <font size="2" color="#0000ff">Dim</font><font size="2"> strFolderName </font><font size="2" color="#0000ff">As</font><font size="2"> </font><font size="2" color="#0000ff">String</font> </p> </font><font size="2"> <p> <font size="2" color="#0000ff">Dim</font><font size="2"> SplitAry1() </font><font size="2" color="#0000ff">As</font><font size="2"> </font><font size="2" color="#0000ff">String</font> </p> </font><font size="2"> <p> <font size="2" color="#0000ff">Dim</font><font size="2"> SplitAry2() </font><font size="2" color="#0000ff">AS</font><font size="2"> </font><font size="2" color="#0000ff">String</font> </p> </font><font size="2"> <p> <font size="2" color="#0000ff">Dim</font><font size="2"> i </font><font size="2" color="#0000ff">As</font><font size="2"> </font><font size="2" color="#0000ff">Integer</font><font size="2"> </font><font size="2" color="#008000">&#39;increment each directory</font> </p> </font><font size="2"> <p> <font size="2" color="#0000ff">Dim</font><font size="2"> l </font><font size="2" color="#0000ff">As</font><font size="2"> </font><font size="2" color="#0000ff">Integer</font> </p> </font><font size="2"> <p> &nbsp; </p> <p> <font size="2" color="#008000">&#39;store the directories here</font> </p> </font><font size="2"> <p> <font size="2" color="#0000ff">if</font><font size="2"> (Directory.Exists(MapPath(_imageFolderPath)) ) </font><font size="2" color="#0000ff">Then</font> </p> </font><font size="2"></font><font size="2" color="#0000ff">Dim</font><font size="2"> aryDirectories() </font><font size="2" color="#0000ff">As</font><font size="2"> </font><font size="2" color="#0000ff">String</font><font size="2"> = Directory.GetDirectories(MapPath(_imageFolderPath))</font><font size="2"> <p> <font size="2" color="#0000ff">Dim</font><font size="2"> length </font><font size="2" color="#0000ff">As</font><font size="2"> </font><font size="2" color="#0000ff">Integer</font><font size="2"> = aryDirectories.Length</font> </p> </font><font size="2" color="#0000ff">For</font><font size="2"> i = 0 </font><font size="2" color="#0000ff">To</font><font size="2"> length - 1</font><font size="2"> <p> <font size="2" color="#008000">&#39;create a ary for the childfolders file list</font> </p> </font><font size="2"> <p> aryChildFolder = Directory.GetFiles(aryDirectories(i), <font size="2" color="#a31515">&quot;*.jpg&quot;</font><font size="2">) </font><font size="2" color="#008000">&#39;assign the list</font> </p> </font><font size="2"></font><font size="2" color="#0000ff">For</font><font size="2"> j = 0 </font><font size="2" color="#0000ff">To</font><font size="2"> aryChildFolder.Length - 1</font><font size="2"> <p> strFileName = Path.GetFileName(aryChildFolder(j)) </p> <p> strFolderName = Path.GetDirectoryName(aryChildFolder(j)) </p> SplitAry1 = strFolderName.Split(</font><font size="2" color="#a31515">&quot;\&quot;</font><font size="2">)</font><font size="2"> SplitAry2 = _imageFolderPath.Split(<font size="2" color="#a31515">&quot;/&quot;</font><font size="2">) </font><font size="2"> <p> strFolderName =<font size="2" color="#a31515">&quot; &quot;</font> </p> </font></font><font size="2"></font><font size="2" color="#0000ff">For</font><font size="2"> l = 0 </font><font size="2" color="#0000ff">To</font><font size="2"> SplitAry2.Length - 1 </font><font size="2" color="#0000ff">Step</font><font size="2"> 1</font><font size="2"> <p> <font size="2" color="#0000ff">If</font><font size="2"> (SplitAry2(l).Length &gt; 0 </font><font size="2" color="#0000ff">And</font><font size="2"> SplitAry2(l) &lt;&gt; </font><font size="2" color="#a31515">&quot;..&quot;</font><font size="2">) </font><font size="2" color="#0000ff">Then</font> </p> </font><font size="2"> <p> strFolderName = strFolderName &amp; <font size="2" color="#a31515">&quot;/&quot;</font><font size="2"> &amp; SplitAry2(l) </font><font size="2" color="#008000">&#39;equal to current</font> </p> </font><font size="2"> <p> <font size="2" color="#0000ff">End</font><font size="2"> </font><font size="2" color="#0000ff">If</font> </p> </font><font size="2"></font><font size="2" color="#0000ff">Next</font><font size="2"> l</font><font size="2"> <p> strFolderName = strFolderName &amp; <font size="2" color="#a31515">&quot;/&quot;</font><font size="2"> &amp; SplitAry1(SplitAry1.Length - 1)</font><font size="2" color="#008000">&#39; the childDirectory</font> </p> </font><font size="2"> <p> strFolderName = strFolderName.Trim() </p> <p> strFolderName = strFolderName.Replace(<font size="2" color="#a31515">&quot;~&quot;</font><font size="2">, </font><font size="2" color="#a31515">&quot;&quot;</font><font size="2">) </font><font size="2" color="#008000">&#39;only work if ~ char exists in string which sould only be at the start</font> </p> </font><font size="2">strFolderName = strFolderName.TrimStart(</font><font size="2" color="#a31515">&quot;/&quot;</font><font size="2">)</font><font size="2"> <p> strFolderName = strFolderName.Trim() </p> <p> <font size="2" color="#008000">&#39;add the items to the collection</font> </p> </font><font size="2"> <p> photoCollection.Add(strFolderName, strFileName) </p> </font><font size="2" color="#0000ff">Next</font><font size="2"> j</font><font size="2"></font><font size="2" color="#0000ff">Next</font><font size="2"> i</font><font size="2"> <p> &nbsp; </p> <p> <font size="2" color="#008000">&#39;Dim jjjj = HttpContext.Current.Request.ApplicationPath</font> </p> </font><font size="2"> <p> <font size="2" color="#008000">&#39;aryDirectories(i)</font> </p> </font><font size="2"> <p> &nbsp; </p> <p> <font size="2" color="#008000">&#39;return a the collection</font> </p> </font><font size="2"> <p> FolderListArray = photoCollection </p> <p> <font size="2" color="#0000ff">Else</font> </p> </font><font size="2"> <p> <font size="2" color="#008000">&#39;return an empty collection</font> </p> </font><font size="2"> <p> FolderListArray = photoCollection </p> <p> <font size="2" color="#0000ff">End</font><font size="2"> </font><font size="2" color="#0000ff">If</font> </p> </font><font size="2"> <p> <font size="2" color="#0000ff">End</font><font size="2"> </font><font size="2" color="#0000ff">Function</font> </p> </font> <p> [/code]

This function will return a NamedValueCollection , the basic structure has each subdirectory as the key with each graphics file assoicated to that key, since a directory requires a unique name all keys will be unique.

The MapPath function is used to resolve a full path from the application root the  _imageFolderPath property is not enough for the Directory.Get methods.

The Directory.GetFiles(aryDirectories(i), "*.jpg") ensures that only JPEG files are save into the collection.

The above code can utilize parameters with the "~" or the relative ".." pass to it, the above code creates a key that drives from the root of the applicaiton to the parent directory . The images however must be organised into a subdirectory even if you just call it e.g "allphotos".

If there are no files found or issue with the paths, the named colleciton will be return as empty and an error will print.

Part 3 - The Html

[code:vb] </p> <font size="2" color="#0000ff"><font size="2" color="#0000ff"> <p> Private<font size="2" color="#000000"> </font><font size="2" color="#0000ff">Function</font><font size="2" color="#000000"> CreateHTML(</font><font size="2" color="#0000ff">ByRef</font><font size="2" color="#000000"> aryCollection </font><font size="2" color="#0000ff">As</font><font size="2" color="#000000"> </font><font size="2" color="#0000ff">Object</font><font size="2" color="#000000">) </font><font size="2" color="#0000ff">As</font><font size="2" color="#000000"> </font><font size="2" color="#0000ff">String</font> </p> </font><font size="2"> <p> <font size="2" color="#008000">&#39;create the stringbuilder</font> </p> </font><font size="2"> <p> <font size="2" color="#0000ff">Dim</font><font size="2"> strHtmlString </font><font size="2" color="#0000ff">As</font><font size="2"> </font><font size="2" color="#0000ff">New</font><font size="2"> StringBuilder </font><font size="2" color="#008000">&#39;to build the HTML String</font> </p> </font><font size="2"> <p> <font size="2" color="#0000ff">Dim</font><font size="2"> aryValues() </font><font size="2" color="#0000ff">As</font><font size="2"> </font><font size="2" color="#0000ff">String</font><font size="2"> </font><font size="2" color="#008000">&#39;Holds an array of Keys</font> </p> </font><font size="2"> <p> <font size="2" color="#0000ff">Dim</font><font size="2"> i </font><font size="2" color="#0000ff">As</font><font size="2"> </font><font size="2" color="#0000ff">Integer</font><font size="2"> </font><font size="2" color="#008000">&#39;loop counter </font> </p> </font><font size="2"> <p> <font size="2" color="#0000ff">Dim</font><font size="2"> intNumbOfRows </font><font size="2" color="#0000ff">As</font><font size="2"> </font><font size="2" color="#0000ff">Integer</font><font size="2"> </font><font size="2" color="#008000">&#39;loop counter</font> </p> </font><font size="2"> <p> <font size="2" color="#0000ff">Dim</font><font size="2"> k </font><font size="2" color="#0000ff">As</font><font size="2"> </font><font size="2" color="#0000ff">Integer</font><font size="2"> </font><font size="2" color="#008000">&#39;loop counter</font> </p> </font><font size="2"> <p> &nbsp; </p> <p> <font size="2" color="#008000">&#39;Preview Image Html Start</font> </p> </font><font size="2"> <p> strHtmlString.Append(<font size="2" color="#a31515">&quot;&lt;div&gt;&quot;</font><font size="2">) </font><font size="2" color="#008000">&#39;opening tag</font> </p> </font><font size="2">strHtmlString.Append(<font size="2" color="#a31515">&quot;&lt;span style=&quot;&quot;background: #b4afa3; padding: 0 1px; border: 1px solid #dcd7c8; &quot;&quot;&gt;&quot;</font><font size="2">) </font><font size="2">strHtmlString.Append(<font size="2" color="#a31515">&quot;&lt;img id=&quot;&quot;imgPreview&quot;&quot; alt=&quot;&quot;PreviewImage&quot;&quot; style=&quot;&quot;padding:5px; background:white;&quot;&quot; /&gt;&quot;</font><font size="2">) strHtmlString.Append(<font size="2" color="#a31515">&quot;&lt;/span&gt;&quot;</font><font size="2">) </font><font size="2"></font></font><font size="2"><font size="2"> <p> strHtmlString.Append(<font size="2" color="#a31515">&quot;&lt;/div&gt;&quot;</font><font size="2">) </font><font size="2" color="#008000">&#39;close the opening tag</font> </p> </font></font></font></font><font size="2">strHtmlString.Append(<font size="2" color="#a31515">&quot;&lt;br /&gt;&quot;</font><font size="2">) </font><font size="2"> <p> <font size="2" color="#008000">&#39;preview Image Stop</font> </p> </font></font><font size="2"> <p> &nbsp; </p> <p> <font size="2" color="#008000">&#39;Catagory Html Start</font> </p> </font><font size="2"> <p> <font size="2" color="#0000ff">For</font><font size="2"> </font><font size="2" color="#0000ff">Each</font><font size="2"> key </font><font size="2" color="#0000ff">As</font><font size="2"> </font><font size="2" color="#0000ff">String</font><font size="2"> </font><font size="2" color="#0000ff">In</font><font size="2"> aryCollection.Keys </font><font size="2" color="#008000">&#39;loop through every subDirectory</font> </p> </font><font size="2"> <p> strHtmlString.Append(<font size="2" color="#a31515">&quot;&lt;div&gt;&quot;</font><font size="2">) </font><font size="2" color="#008000">&#39;opening tag</font> </p> </font><font size="2">strHtmlString.Append(<font size="2" color="#a31515">&quot;&lt;strong style=&quot;&quot;font-size:120%&quot;&quot;&gt;&quot;</font><font size="2">) </font><font size="2"> <p> strHtmlString.Append(key) <font size="2" color="#008000">&#39; Name of the Catagory</font> </p> </font></font><font size="2">strHtmlString.Append(<font size="2" color="#a31515">&quot;&lt;/strong&gt;&quot;</font><font size="2">) </font><font size="2">strHtmlString.Append(<font size="2" color="#a31515">&quot; (Click Image to Enlarge)&quot;</font><font size="2">) </font><font size="2"> <p> strHtmlString.Append(<font size="2" color="#a31515">&quot;&lt;hr /&gt;&quot;</font><font size="2">) </font><font size="2" color="#008000">&#39;line space</font> </p> </font></font></font><font size="2"> <p> strHtmlString.Append(<font size="2" color="#a31515">&quot;&lt;table cellspacing=&quot;&quot;10&quot;&quot;&gt;&quot;</font><font size="2">) </font><font size="2" color="#008000">&#39;opend the table</font> </p> </font><font size="2"> <p> aryValues = aryCollection.GetValues(key) </p> <font size="2"> <p> <font size="2" color="#0000ff">If</font><font size="2"> (((aryValues.Length) </font><font size="2" color="#0000ff">Mod</font><font size="2"> intItemsPerRow) &gt; 0) </font><font size="2" color="#0000ff">Then</font><font size="2"> </font><font size="2" color="#008000">&#39; if there is a remainder do an integer division and add one to round up </font> </p> </font></font><font size="2"> <p> <font size="2" color="#008000">&#39;the rounding will round down so add extra row to compensate</font> </p> </font><font size="2"> <p> intNumbOfRows = (aryValues.Length \ intItemsPerRow) + 1 <font size="2" color="#008000">&#39;rounds up</font> </p> </font><font size="2"> <p> <font size="2" color="#0000ff">Else</font><font size="2"> : intNumbOfRows = ((aryValues.Length) / intItemsPerRow) </font><font size="2" color="#008000">&#39; no round as there is no remainder</font> </p> </font><font size="2"> <p> <font size="2" color="#0000ff">End</font><font size="2"> </font><font size="2" color="#0000ff">If</font> </p> </font><font size="2"> <p> <font size="2" color="#0000ff">While</font><font size="2"> (i &lt; aryValues.Length) </font><font size="2" color="#008000">&#39;loop through all files in the subdirectory</font> </p> </font><font size="2"><font size="2" color="#0000ff">For</font><font size="2"> j </font><font size="2" color="#0000ff">As</font><font size="2"> </font><font size="2" color="#0000ff">Integer</font><font size="2"> = 1 </font><font size="2" color="#0000ff">To</font><font size="2"> intNumbOfRows </font><font size="2">strHtmlString.Append(<font size="2" color="#a31515">&quot;&lt;tr&gt;&quot;</font><font size="2">) <font size="2" color="#0000ff">While</font><font size="2"> (k &lt; intItemsPerRow </font><font size="2" color="#0000ff">And</font><font size="2"> i &lt; aryValues.Length) </font><font size="2"></font></font><font size="2"><font size="2"> <p> strHtmlString.Append(<font size="2" color="#a31515">&quot;&lt;td&gt;&quot;</font><font size="2">) </font><font size="2" color="#008000">&#39;background: #b4afa3;</font> </p> </font></font></font></font><font size="2">strHtmlString.Append(<font size="2" color="#a31515">&quot;&lt;span style=&quot;&quot;background: #b4afa3; padding: 0 1px; border: 1px solid #dcd7c8; &quot;&quot;&gt;&quot;</font><font size="2">) </font><font size="2">strHtmlString.Append(<font size="2" color="#a31515">&quot;&lt;img style=&quot;&quot;padding:5px; background:white;&quot;&quot; src=&quot;&quot;&quot;</font><font size="2">) </font><font size="2"> <p> strHtmlString.Append(key) </p> strHtmlString.Append(<font size="2" color="#a31515">&quot;/&quot;</font><font size="2">) </font><font size="2"> <p> strHtmlString.Append(aryValues(i)) </p> strHtmlString.Append(<font size="2" color="#a31515">&quot;&quot;&quot; width=&quot;&quot; 100px &quot;&quot; onclick=&#39;imgPreview.src = this.src; window.scrollTo(0,80);&#39;/&gt;&quot;</font><font size="2">) strHtmlString.Append(<font size="2" color="#a31515">&quot;&lt;/span&gt;&quot;</font><font size="2">) </font><font size="2"></font></font><font size="2"><font size="2">strHtmlString.Append(<font size="2" color="#a31515">&quot;&lt;/td&gt;&quot;</font><font size="2">) </font><font size="2"> <p> k = k + 1 <font size="2" color="#008000">&#39;move onto next item</font> </p> </font></font></font></font></font></font></font><font size="2"> <p> i = i + 1 <font size="2" color="#008000">&#39; move onto next image in the subdirectory</font> </p> </font><font size="2"> <p> <font size="2" color="#0000ff">End</font><font size="2"> </font><font size="2" color="#0000ff">While</font> </p> </font><font size="2"> <p> k = 0 <font size="2" color="#008000">&#39;reset for next loop </font> </p> </font><font size="2">strHtmlString.Append(<font size="2" color="#a31515">&quot;&lt;/tr&gt;&quot;</font><font size="2">) </font><font size="2"><font size="2" color="#0000ff">Next</font><font size="2"> j </font><font size="2"> <p> <font size="2" color="#0000ff">End</font><font size="2"> </font><font size="2" color="#0000ff">While</font> </p> </font></font></font><font size="2"> <p> i = 0 <font size="2" color="#008000">&#39;reset for next loop</font> </p> </font><font size="2"> <p> strHtmlString.Append(<font size="2" color="#a31515">&quot;&lt;/table&gt;&quot;</font><font size="2">) </font><font size="2" color="#008000">&#39;close the table</font> </p> </font><font size="2"> <p> strHtmlString.Append(<font size="2" color="#a31515">&quot;&lt;/div&gt;&quot;</font><font size="2">) </font><font size="2" color="#008000">&#39;close opening tag</font> </p> </font><font size="2"><font size="2" color="#0000ff">Next</font><font size="2"> key </font><font size="2"> <p> <font size="2" color="#008000">&#39;Catagory Html Stop</font> </p> </font></font><font size="2"> <p> <font size="2" color="#008000">&#39;Return the HTML String</font> </p> </font><font size="2"> <p> CreateHTML = strHtmlString.ToString </p> <p> <font size="2" color="#0000ff">End</font><font size="2"> </font><font size="2" color="#0000ff">Function</font> </p> </font></font><font size="2"><font size="2"></font></font> <p> [/code]

The above code builds a table for each catagory using the paramert 'intItemsPerRow', to determine the need number of table rows. inline evet hander is used to print each image to the previmage at the top of the page.

Part 4 - The PageLoad

[code:vb] </p> <font size="2"><font size="2"> <p> Public Sub Page_Load() </p> </font><font size="2" color="#0000ff">Dim</font><font size="2"> aryCollection </font><font size="2" color="#0000ff">As</font><font size="2"> NameValueCollection </font></font><font size="2"> <p> <font size="2" color="#0000ff">Dim</font><font size="2"> strHtml </font><font size="2" color="#0000ff">As</font><font size="2"> </font><font size="2" color="#0000ff">String</font> </p> </font><font size="2"> <p> &nbsp; </p> <p> aryCollection = FolderListArray(_imageFolderPath) </p> <p> <font size="2" color="#0000ff">If</font><font size="2">(aryCollection.Count &gt; 0) </font><font size="2" color="#0000ff">then</font> </p> </font><font size="2"> <p> strHtml = CreateHTML(aryCollection) </p> <p> Label1.Text = strHtml </p> <p> <font size="2" color="#0000ff">Else</font> </p> </font><font size="2"> <p> Label1.Text = <font size="2" color="#a31515">&quot;Error Directory does not exist or invaid path given &quot;</font> </p> </font><font size="2"> <p> <font size="2" color="#0000ff">End</font><font size="2"> </font><font size="2" color="#0000ff">if</font> </p> </font><font size="2"> <p> <font size="2" color="#0000ff">End</font><font size="2"> </font><font size="2" color="#0000ff">Sub</font> </p> </font><font size="2"><font size="2" color="#0000ff">&lt;/</font><font size="2" color="#a31515">script</font><font size="2" color="#0000ff">&gt; </font><font size="2" color="#0000ff">&lt;<font size="2" color="#a31515">asp</font><font size="2" color="#0000ff">:</font><font size="2" color="#a31515">Label</font><font size="2"> </font><font size="2" color="#ff0000">ID</font><font size="2" color="#0000ff">=&quot;Label1&quot;</font><font size="2"> </font><font size="2" color="#ff0000">runat</font><font size="2" color="#0000ff">=&quot;server&quot;</font><font size="2"> </font><font size="2" color="#ff0000">EnableViewState</font><font size="2" color="#0000ff">=&quot;false&quot;</font><font size="2"> </font><font size="2" color="#ff0000">Text</font><font size="2" color="#0000ff">=&quot;Label&quot;&gt;&lt;/</font><font size="2" color="#a31515">asp</font><font size="2" color="#0000ff">:</font><font size="2" color="#a31515">Label</font><font size="2" color="#0000ff">&gt; </font><font size="2" color="#0000ff"></font></font></font> <p> [/code]

The Label1 is used to hold the HTML, if the namedvalue collection is = 0 then and error is printed.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags:   ,
Categories:   ASP.NET
Actions:   E-mail | Permalink | Comments (0) | Comment RSSRSS comment feed