Sunday, August 26, 2012
Get computer names in the Network
7:46 AM |
Posted by
Sheen |
Edit Post
I wanted to get all the computer's names as I was doing a till balancing program, related to a supermarket (POS application). On a report I wanted to filter the daily balance.
Daily balance of all stations and station wise. I thought this might helpful, if I share the code snippet with you.
private List ComputersInNetwork()
{
List computerList= new List();
using (DirectoryEntry root = new DirectoryEntry("WinNT:"))
{
foreach (DirectoryEntry computers in root.Children)
{
foreach (DirectoryEntry computer in computers.Children)
{
if ((computer.Name != "Schema"))
{
computerList.Add(computer.Name);
}
}
}
}
computerList.Add("All");
computerList.Sort();
return list;
}
Happy coding.
Daily balance of all stations and station wise. I thought this might helpful, if I share the code snippet with you.
private List
{
List
using (DirectoryEntry root = new DirectoryEntry("WinNT:"))
{
foreach (DirectoryEntry computers in root.Children)
{
foreach (DirectoryEntry computer in computers.Children)
{
if ((computer.Name != "Schema"))
{
computerList.Add(computer.Name);
}
}
}
}
computerList.Add("All");
computerList.Sort();
return list;
}
Happy coding.
Monday, July 23, 2012
Illegal characters in path (XmlDocument.Load())
1:03 AM |
Posted by
Sheen |
Edit Post
This occurs due to not understanding the expected parameter type for the XmlDocument.Load("filename") method. This method expect a file name.
Look at the following example, this throw the above error.
eg:
//getting a soap response
string sXml = nc.CurrencyExchangeRatesForWeb();
XmlDocument doc = new XmlDocument();
doc.Load(sXml);
To avoid this error, we can use XmlDocument.LoadXml("string") method, following example shows the solution,
eg:
string sXml = nc.CurrencyExchangeRatesForWeb();
XmlDocument doc = new XmlDocument();
doc.LoadXml(sXml);
Happy coding
Look at the following example, this throw the above error.
eg:
//getting a soap response
string sXml = nc.CurrencyExchangeRatesForWeb();
XmlDocument doc = new XmlDocument();
doc.Load(sXml);
To avoid this error, we can use XmlDocument.LoadXml("string") method, following example shows the solution,
eg:
string sXml = nc.CurrencyExchangeRatesForWeb();
XmlDocument doc = new XmlDocument();
doc.LoadXml(sXml);
Happy coding
Tuesday, July 17, 2012
Get File Name from path string
5:25 PM |
Posted by
Sheen |
Edit Post
I have seen many young developers are struggle with getting
the only the file name from the full path.
Here is a simple code snippet to get the file name.
string path = "C:\\TEMP\\temp.bmp";
string fileName = System.IO.Path.GetFileName(path);
Happy coding.
the only the file name from the full path.
Here is a simple code snippet to get the file name.
string path = "C:\\TEMP\\temp.bmp";
string fileName = System.IO.Path.GetFileName(path);
Happy coding.
Thursday, September 08, 2011
Cannot evaluate expression because a thread is stopped at a point where garbage collection is impossible, possibly because the code is optimized.
11:10 AM |
Posted by
Sheen |
Edit Post
Tuesday, February 01, 2011
Gridview RowEditing checkbox value
4:32 PM |
Posted by
Sheen |
Edit Post
We know if we have manually binds the data then, we can access the checkbox or what ever the control by it's id.
as follows
CheckBox ck = (CheckBox)GridView1.Rows[e.NewEditIndex].Cells[8].FindControl("yourCheckBoxControl");
What if you auto bided the data to a gridview,
CheckBox ck = (CheckBox)GridView1.Rows[e.NewEditIndex].Cells[8].Controls[0];
Subscribe to:
Posts (Atom)
Blog Archive
Important Blogs
-
Git Workflow For Enterprise development6 years ago
-
-
Watch Live Cricket Online Free14 years ago
-
-
-
-