<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Open Script Solution &#187; get</title>
	<atom:link href="http://www.openscriptsolution.com/tag/get/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.openscriptsolution.com</link>
	<description>... where solutions for script programming are found ...</description>
	<lastBuildDate>Sun, 29 Aug 2010 10:35:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Displaying Some Comma-Separated Sub-String Values from A Single String to The Checked CheckBoxes Control in PHP</title>
		<link>http://www.openscriptsolution.com/2009/12/11/displaying-some-comma-separated-sub-string-values-from-a-single-string-to-the-checked-checkboxes-control-in-php/</link>
		<comments>http://www.openscriptsolution.com/2009/12/11/displaying-some-comma-separated-sub-string-values-from-a-single-string-to-the-checked-checkboxes-control-in-php/#comments</comments>
		<pubDate>Fri, 11 Dec 2009 16:40:26 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[checkboxes]]></category>
		<category><![CDATA[checked]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[display]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[get]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=1004</guid>
		<description><![CDATA[Yesterday I faced a situation while I was trying to get some sub-string values that derived from a single string that being saved in database, and displayed them to the checked CheckBoxes control in PHP. Let&#8217;s say I had 5 CheckBoxes control named Applications on my form, whereas the values stored in a single string [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I faced a situation while I was trying to get some sub-string values that derived from a single string that being saved in database, and displayed them to the checked <strong>CheckBoxes</strong> control in PHP. Let&#8217;s say I had 5 CheckBoxes control named <strong>Applications</strong> on my form, whereas the values stored in a single string from database, for instance, is: &#8220;Application 1, Application 3, Application 5&#8243;. Then I wanted that the first, the third, and the fifth CheckBoxes would be checked based on that string. So, finally, I wrote this following code to solve my problem. <span id="more-1004"></span></p>
<p>Here is the code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> 
    <span style="color: #666666; font-style: italic;">// assuming the value of $strApplications received from database</span>
    <span style="color: #000088;">$strApplications</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Application 1, Application 3, Application 5&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
    &lt;tr&gt;
      &lt;td&gt;Applications: &lt;/td&gt;
      &lt;td&gt;
        <span style="color: #000000; font-weight: bold;">&lt;?php</span>  
	  <span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$j</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> <span style="color: #000088;">$j</span><span style="color: #339933;">&lt;=</span><span style="color: #cc66cc;">5</span><span style="color: #339933;">;</span> <span style="color: #000088;">$j</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>	          
            <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;input type=&quot;checkbox&quot; name=&quot;applications[]&quot; value=&quot;Application '</span><span style="color: #339933;">.</span><span style="color: #000088;">$j</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; '</span><span style="color: #339933;">;</span>		
	    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">strpos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$strApplications</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Application '</span><span style="color: #339933;">.</span><span style="color: #000088;">$j</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!==</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	      <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'checked'</span><span style="color: #339933;">;</span>  <span style="color: #666666; font-style: italic;">// which checkbox(es) should be checked</span>
	    <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
	      <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>  <span style="color: #666666; font-style: italic;">// otherwise, leave it unchecked</span>
	    <span style="color: #009900;">&#125;</span>	
	    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&gt;Application '</span><span style="color: #339933;">.</span><span style="color: #000088;">$j</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;br /&gt;'</span><span style="color: #339933;">;</span>
          <span style="color: #009900;">&#125;</span>
          <span style="color: #000000; font-weight: bold;">?&gt;</span>      
      &lt;/td&gt;
    &lt;/tr&gt;</pre></div></div>

<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.openscriptsolution.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.openscriptsolution.com/2009/12/11/displaying-some-comma-separated-sub-string-values-from-a-single-string-to-the-checked-checkboxes-control-in-php/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to Get Data from Excel Worksheet Using VB6</title>
		<link>http://www.openscriptsolution.com/2009/09/02/how-to-get-data-from-excel-worksheet-using-vb6/</link>
		<comments>http://www.openscriptsolution.com/2009/09/02/how-to-get-data-from-excel-worksheet-using-vb6/#comments</comments>
		<pubDate>Wed, 02 Sep 2009 07:09:02 +0000</pubDate>
		<dc:creator>Masino Sinaga</dc:creator>
				<category><![CDATA[Excel File]]></category>
		<category><![CDATA[ambil]]></category>
		<category><![CDATA[baca]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[get]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[object]]></category>
		<category><![CDATA[retrieve]]></category>

		<guid isPermaLink="false">http://www.openscriptsolution.com/?p=181</guid>
		<description><![CDATA[You can read and retrieve data from Microsoft Excel Worksheet easily by using your application that you made by Visual Basic 6 (VB6) programming. Simply just using its Microsoft Excel Object Library reference provided by VB6. The following code will show you how we can do that step by step. Started from how we can [...]]]></description>
			<content:encoded><![CDATA[<p>You can read and retrieve data from Microsoft Excel Worksheet easily by using your application that you made by Visual Basic 6 (VB6) programming. Simply just using its Microsoft Excel Object Library reference provided by VB6. The following code will show you how we can do that step by step. Started from how we can prepare the Excel object, get or create the Excel object, opening the Excel file, opening the Excel worksheet, accessing (read and displaying) the data from Excel file, closing the Excel worksheet, closing the Excel file, until cleaning-up the memory used by the Excel object. This is very very important for you, since almost our data stored in Microsoft Excel file, and not always in the database. <span id="more-181"></span></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #008000;">'Description: Read and get data from an Excel worksheet and 
</span><span style="color: #008000;">'             display it from the first row until the fifth row
</span><span style="color: #008000;">'             by using a MsgBox in Visual Basic 6.
</span><span style="color: #008000;">'             Including the technique how you should access Excel 
</span><span style="color: #008000;">'             step by step properly, from opening the Excel file until
</span><span style="color: #008000;">'             close and clear the memory that used by Excel object.
</span><span style="color: #008000;">'Author     : Masino Sinaga
</span><span style="color: #008000;">'Date       : Sunday, August 2, 2009
</span><span style="color: #008000;">'Preparation: 1. Create a new Standard exe project with 1 form
</span><span style="color: #008000;">'             2. Add 1 CommandButton control on the Form1
</span><span style="color: #008000;">'             3. Add an item &quot;Microsoft Excel X.X Object Library&quot;
</span><span style="color: #008000;">'                from menu Project -&gt; References... . X.X depends on
</span><span style="color: #008000;">'                version Excel or Microsoft Office you are using.
</span><span style="color: #008000;">'                When I tried this code, it had been installed 
</span><span style="color: #008000;">'                Microsoft Office 2000 and Microsoft Office 2007,
</span><span style="color: #008000;">'                thus, X.X above is equal with 12.0 which VB6
</span><span style="color: #008000;">'                displaying only the last version object library Excel. 
</span><span style="color: #008000;">'                In this case, Microsoft Excel 12.0 Object Library 
</span><span style="color: #008000;">'             4. Ensure your Dataku.xls file already exists in the same
</span><span style="color: #008000;">'                directory where your application located, and in
</span><span style="color: #008000;">'                column B started from the first row until the fifth row
</span><span style="color: #008000;">'                you already have value in it.
</span><span style="color: #008000;">'             5. Copy the following code to the Form1 editor.
</span><span style="color: #008000;">'------------------------------------------------------------------
</span>
<span style="color: #000080;">Dim</span> Excel <span style="color: #000080;">As</span> Excel.Application <span style="color: #008000;">'Excel Application
</span><span style="color: #000080;">Dim</span> ExcelWBk <span style="color: #000080;">As</span> Excel.Workbook <span style="color: #008000;">'Excel Workbook
</span><span style="color: #000080;">Dim</span> ExcelWS <span style="color: #000080;">As</span> Excel.Worksheet <span style="color: #008000;">'Excel Worksheet
</span>
<span style="color: #000080;">Private</span> <span style="color: #000080;">Sub</span> Command1_Click()
  <span style="color: #000080;">On</span> <span style="color: #000080;">Error</span> <span style="color: #000080;">GoTo</span> Err
  <span style="color: #008000;">'Inisialitation Excel object
</span>  StartExcel
  <span style="color: #008000;">'Open Dataku.xls file that located in the same directory
</span>  <span style="color: #008000;">'where your application located.
</span>  <span style="color: #000080;">Set</span> ExcelWBk = Excel.Workbooks.<span style="color: #000080;">Open</span>(App.Path &amp; <span style="color: #800000;">&quot;\Dataku.xls&quot;</span>)
  <span style="color: #008000;">'Displaying its status on the form
</span>  <span style="color: #000080;">Print</span> <span style="color: #800000;">&quot;Successfully open file ...&quot;</span>
  <span style="color: #008000;">'Access the first Worksheet (1)
</span>  <span style="color: #008000;">'If you want to switch to the second Worksheet, then
</span>  <span style="color: #008000;">'simply replace (1) with (2), and so forth...
</span>  <span style="color: #000080;">Set</span> ExcelWS = ExcelWBk.Worksheets(1)
  <span style="color: #008000;">'Displaying its status on the form
</span>  <span style="color: #000080;">Print</span> <span style="color: #800000;">&quot;Successfully read Worksheet Sheet1 ...&quot;</span>
  <span style="color: #008000;">'Processing the ExcelWS variable
</span>  <span style="color: #000080;">With</span> ExcelWS
    <span style="color: #000080;">Dim</span> i <span style="color: #000080;">As</span> <span style="color: #000080;">Integer</span>
    <span style="color: #000080;">Dim</span> strData <span style="color: #000080;">As</span> <span style="color: #000080;">String</span>
    <span style="color: #008000;">'Read from the first row until the fifth row
</span>    <span style="color: #000080;">For</span> i = 1 <span style="color: #000080;">To</span> 5
      <span style="color: #008000;">'Assign to a variabel
</span>      strData = strData &amp; .Cells(i, 2) &amp; vbCrLf
    <span style="color: #000080;">Next</span> i
  <span style="color: #000080;">End</span> <span style="color: #000080;">With</span>
  <span style="color: #008000;">'Displaying the data to MsgBox
</span>  MsgBox strData
  <span style="color: #008000;">'After finished, don't forget to close the worksheet
</span>  CloseWorkSheet
  <span style="color: #008000;">'Displaying its status on the form
</span>  <span style="color: #000080;">Print</span> <span style="color: #800000;">&quot;Successfully close worksheet and Excel file ...&quot;</span>
  <span style="color: #008000;">'Don' forget neither, always clean-up the memory that
</span>  <span style="color: #008000;">'has just been used by Excel object
</span>  ClearExcelMemory
  <span style="color: #008000;">'Displaying its status on the form
</span>  <span style="color: #000080;">Print</span> <span style="color: #800000;">&quot;Successfully clean-up the memory used by Excel ...&quot;</span>
  <span style="color: #008000;">'Displaying the message
</span>  MsgBox <span style="color: #800000;">&quot;Finish, that's all folks ...!&quot;</span>, vbInformation, <span style="color: #800000;">&quot;Good&quot;</span>
  <span style="color: #000080;">Exit</span> <span style="color: #000080;">Sub</span>
Err:
  <span style="color: #008000;">'CloseWorkSheet
</span>  <span style="color: #008000;">'When error occured, don't forget to clean-up the memory
</span>  ClearExcelMemory
  MsgBox Err.Description, vbCritical, <span style="color: #800000;">&quot;Error Occured&quot;</span>
<span style="color: #000080;">End</span> <span style="color: #000080;">Sub</span>
&nbsp;
<span style="color: #000080;">Private</span> <span style="color: #000080;">Sub</span> StartExcel()
  <span style="color: #000080;">On</span> <span style="color: #000080;">Error</span> <span style="color: #000080;">GoTo</span> Err:
  <span style="color: #008000;">'First of all, get the Excel object, and if error occured
</span>  <span style="color: #008000;">'jumpt to the Err label on the bottom of this Sub,
</span>  <span style="color: #008000;">'then create the Excel object. Typically, error occured here
</span>  <span style="color: #008000;">'if the Excel object has not been created, yet
</span>  <span style="color: #000080;">Set</span> Excel = GetObject(, <span style="color: #800000;">&quot;Excel.Application&quot;</span>)
  <span style="color: #000080;">Exit</span> <span style="color: #000080;">Sub</span>
Err:
  <span style="color: #008000;">'Create an Excel object if it does not exist.
</span>  <span style="color: #000080;">Set</span> Excel = CreateObject(<span style="color: #800000;">&quot;Excel.Application&quot;</span>)
<span style="color: #000080;">End</span> <span style="color: #000080;">Sub</span>
&nbsp;
<span style="color: #000080;">Private</span> <span style="color: #000080;">Sub</span> CloseWorkSheet()
  <span style="color: #000080;">On</span> <span style="color: #000080;">Error</span> <span style="color: #000080;">Resume</span> <span style="color: #000080;">Next</span>
  <span style="color: #008000;">'Close the Excel workbook
</span>  ExcelWBk.<span style="color: #000080;">Close</span>
  <span style="color: #008000;">'Quit from Excel application
</span>  Excel.Quit
<span style="color: #000080;">End</span> <span style="color: #000080;">Sub</span>
&nbsp;
<span style="color: #000080;">Private</span> <span style="color: #000080;">Sub</span> ClearExcelMemory()
  <span style="color: #008000;">'Clean-up the memory, check first, whether
</span>  <span style="color: #008000;">'the Excel object exists or not in the memory ...
</span>  <span style="color: #000080;">If</span> <span style="color: #000080;">Not</span> ExcelWS <span style="color: #000080;">Is</span> <span style="color: #000080;">Nothing</span> <span style="color: #000080;">Then</span> <span style="color: #000080;">Set</span> ExcelWS = <span style="color: #000080;">Nothing</span>
  <span style="color: #000080;">If</span> <span style="color: #000080;">Not</span> ExcelWBk <span style="color: #000080;">Is</span> <span style="color: #000080;">Nothing</span> <span style="color: #000080;">Then</span> <span style="color: #000080;">Set</span> ExcelWBk = <span style="color: #000080;">Nothing</span>
  <span style="color: #000080;">If</span> <span style="color: #000080;">Not</span> Excel <span style="color: #000080;">Is</span> <span style="color: #000080;">Nothing</span> <span style="color: #000080;">Then</span> <span style="color: #000080;">Set</span> Excel = <span style="color: #000080;">Nothing</span>
<span style="color: #000080;">End</span> <span style="color: #000080;">Sub</span></pre></td></tr></table></div>

<p>Do not forget to always cleaning-up the memory used by your Excel object. If you do not handle this, then you can not open your Excel file, until you have to first clear the memory used by your Excel object by pressing <strong>End Task</strong> button in the <strong>Task Manager</strong> dialogue box.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.openscriptsolution.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.openscriptsolution.com/2009/09/02/how-to-get-data-from-excel-worksheet-using-vb6/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>