ManagementObjectSearcher mosPrinter = new ManagementObjectSearcher("SELECT * FROM Win32_Printer");<br/>
foreach (ManagementObject moDiskete in mosPrinter.Get())<br/>
{
foreach (PropertyData p in moDiskete.Properties)<br/>
{<br/>
// listBox1.Items.Add(p.Value);<br/>
listBox1.Items.Add(String.Format("{0}: {1}", p.Name, p.Value == null ? "NULL" :myprint.DocumentName=p.Value.ToString()));
// myprint.DocumentName = p.Value.ToString();<br/>
<br/>
}<br/>
<br/>
myprint.Print();
}
In the class level i did: <span style="color:#2b91af; font-size:x-small
<span style="color:#2b91af; font-size:x-small <font size="2" color="#2b91af <font size="2" color="#2b91af
PrintDocument
</font></font><font size="2" color="#2b91af
</font>
<span style="font-size:x-small myprint;
<span style="font-size:x-small And in the construstor: <span style="font-size:x-small
<font size="2
myprint =
</font>
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small new<span style="font-size:x-small
<span style="color:#2b91af; font-size:x-small <span style="color:#2b91af; font-size:x-small PrintDocument<span style="font-size:x-small ();
The p.Value show the value of each property in the listbox1 so i want to print all the properties in the listbox1 or if im wrong i want to print all the content of the listbox1 now i mean what it shows currently so its the properties in this case so it iwll
print the list of the properties as it show like p.Value but maybe i should do instead p.Value somehow to try to print the listbox1.text or something?
In any case when im doing myprint.DocumentName=p.Value.ToString())); all the prints are false so the page that is coming out is empty. Im not getting any error just empty page from the printer. So i guess i did something wrong. So how do i print
the listbox1 content? The currently text that is in the listbox1.
Thanks for help.
<hr class="sig danieli
View the full article
foreach (ManagementObject moDiskete in mosPrinter.Get())<br/>
{
foreach (PropertyData p in moDiskete.Properties)<br/>
{<br/>
// listBox1.Items.Add(p.Value);<br/>
listBox1.Items.Add(String.Format("{0}: {1}", p.Name, p.Value == null ? "NULL" :myprint.DocumentName=p.Value.ToString()));
// myprint.DocumentName = p.Value.ToString();<br/>
<br/>
}<br/>
<br/>
myprint.Print();
}
In the class level i did: <span style="color:#2b91af; font-size:x-small
<span style="color:#2b91af; font-size:x-small <font size="2" color="#2b91af <font size="2" color="#2b91af
PrintDocument
</font></font><font size="2" color="#2b91af
</font>
<span style="font-size:x-small myprint;
<span style="font-size:x-small And in the construstor: <span style="font-size:x-small
<font size="2
myprint =
</font>
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small new<span style="font-size:x-small
<span style="color:#2b91af; font-size:x-small <span style="color:#2b91af; font-size:x-small PrintDocument<span style="font-size:x-small ();
The p.Value show the value of each property in the listbox1 so i want to print all the properties in the listbox1 or if im wrong i want to print all the content of the listbox1 now i mean what it shows currently so its the properties in this case so it iwll
print the list of the properties as it show like p.Value but maybe i should do instead p.Value somehow to try to print the listbox1.text or something?
In any case when im doing myprint.DocumentName=p.Value.ToString())); all the prints are false so the page that is coming out is empty. Im not getting any error just empty page from the printer. So i guess i did something wrong. So how do i print
the listbox1 content? The currently text that is in the listbox1.
Thanks for help.
<hr class="sig danieli
View the full article