|
You think the detail of that exception might be handy in solving your problem
|
|
|
|
|
try the following, using system.io;
DirectoryInfo di = new DirectoryInfo("FolderPath");
foreach(FileInfo file in di.GetFiles())
{
string name = file.Name;
string fullName = file.FullName;
}
//plus alot more useful properties
If only MySelf.Visible was more than just a getter...
A person can produce over 5 times there own body weight in excrement each year... please re-read your questions before posting
|
|
|
|
|
hi,
i want to know how can i declare axhwinterface
assume
value= axhwinterfacei.input(888);
i wrote it in my code but the program make error on it
|
|
|
|
|
That's a 3rd parth component, which you obviously don't have. Where did you get the code?? Because, chances are, that'll also be the place to get the component you're missing (HWInterface).
|
|
|
|
|
i found it when i search in sites
the code contain two statement
val=axHwinterface1.InPort(888);
axHwinterface1.OutPort(888,(short)(val|2));
i searched more to find more information about it
but i didnot find any thing or how i can declared it for using
now i want to know how i can take information from
status register and make check on it(this check to tell me if parallel port free or not)
thanks
|
|
|
|
|
You need a third party library to do something like this. Google for "Logix4u" and you'll find one.
|
|
|
|
|
i downloaded hwinterface file system and i put it within project
but when i wrote this word in code made error (this name doesnot exist in the current text)i want to know if it want write something like(using system......)or not
|
|
|
|
|
If the .DLL you got is COM-based, then you can install it and add a reference to it.
If not, then you have to use PInvoke methods to get at the functions in the .DLL.
Just dropping the .DLL in your project folder does not make it magically work.
|
|
|
|
|
|
|
I think what you're asking is how to read a text file in C#? If so, add a textbox control to your form and a button, then double-click on that button and enter the following code:
StreamReader ReadFile = new StreamReader("C:\\MyTextFile.txt");
textBox1.Text = ReadFile.ReadToEnd();
ReadFile.Dispose();
Now that you've got the code to read from a text file, you need to add a using to the top of your document, add the following line to the top of the page:
using System.IO;
Hope this helps dude.
j.t.
j.t.
|
|
|
|
|
Hi,
I have to do a project on "Server Monitoring and Management using TCP and UDP"..Can you please send me any links or documents to give an idea about what does that actually mean and why is it necessary to do that....Please help me with this...thanks for any help in advance...
|
|
|
|
|
It doesn't mean much. The first bit is about managing a server, the second are network protocols. Surely you have some more requirements than that??
Regards,
Rob Philpott.
|
|
|
|
|
hi ,
all how i make a setup of my windows application for installtion can any body guide me or point me in right direction .
Best regards
Rameez
|
|
|
|
|
There are applications that can build a setup for you. Google for these terms;
- OneClick
- InnoSetup
- MSI
- InstallShield
HTH
I are troll
|
|
|
|
|
|
there is a project type in visual studio :
"New Project -> Other Project Types -> Setup and Deployment"
i used it and made a setup for my application. it is very cool and has several options that makes your work very easy.
sometimes 0 can be 1
|
|
|
|
|
Hi
You can in Visual Studio 08 Prof make another project under File -> New -> Project -> Other Project Types-> Setup Project.
Then you configure the installation project.
When you are finnished you click make Setup Project and then you have the *.exe file saved in a output folder.
DJ-Boris
|
|
|
|
|
This is My data
CategName subCateName Id Products
NULL NULL 6 Prod3
NULL NULL 9 SalesProd7
Beverages Beers 15 Bell Lager 500 ML
Beverages Beers 16 CLUB PILSENER 500 ML
Beverages Juices 24 Apple Juice
Beverages Juices 25 Chikooo Juice
Beverages SoftDrinks 26 Coke
Beverages SoftDrinks 27 Pepsi
Beverages Wines 28 RED WINE
Beverages Wines 29 White Wine
Food MeatProducts36 GOAT MEAT
Food Fruits 18 APPLE GREEN
Food Fruits 19 LOCAL ORANGES
Others OtherItems 30 BENSON & HEDGES LIGHT
VegeTable NULL 20 BEETROOT
VegeTable NULL 21 TOMATO FRESH
I got the above data into Datatable 'table' and I am trying to insert into tree view
as Categories-subcategories-Products. I have tried the following and my output in such a way i get only
one product for each categorie and sub categorie.
if (table != null)
{
foreach (DataRow row in table.Rows)
{
MainNode = new TreeNode(row.ItemArray[0].ToString());
MainNode.Name = row.ItemArray[0].ToString();
if (MainNode.Text == "")
{
MainNode = new TreeNode(row.ItemArray[1].ToString());
MainNode.Name = row.ItemArray[1].ToString();
if (MainNode.Text == "")
{
MainNode = new TreeNode(row.ItemArray[3].ToString());
MainNode.Name = row.ItemArray[3].ToString();
MainNode.Tag = row.ItemArray[2].ToString();
if (!RootNode.Nodes.ContainsKey(MainNode.Name))
{
RootNode.Nodes.Add(MainNode);
} }
else
{
ChildNode = new TreeNode(row.ItemArray[3].ToString());
ChildNode.Name = row.ItemArray[3].ToString();
ChildNode.Tag = row.ItemArray[2].ToString();
if (!MainNode.Nodes.ContainsKey(ChildNode.Name))
{
MainNode.Nodes.Add(ChildNode);
}
if (!RootNode.Nodes.ContainsKey(MainNode.Name))
{
RootNode.Nodes.Add(MainNode);
} } }
else
{
ChildNode = new TreeNode(row.ItemArray[1].ToString());
ChildNode.Name = row.ItemArray[1].ToString();
if (ChildNode.Text == "")
{
ChildNode = new TreeNode(row.ItemArray[3].ToString());
ChildNode.Name = row.ItemArray[3].ToString();
ChildNode.Tag = row.ItemArray[2].ToString();
if (!MainNode.Nodes.ContainsKey(ChildNode.Name))
{
MainNode.Nodes.Add(ChildNode);
} }
else
{
SubNode = new TreeNode(row.ItemArray[3].ToString());
SubNode.Name = row.ItemArray[3].ToString();
SubNode.Tag = row.ItemArray[2].ToString();
if (!ChildNode.Nodes.ContainsKey(SubNode.Name))
{
ChildNode.Nodes.Add(SubNode);
} }
if (!MainNode.Nodes.ContainsKey(ChildNode.Name))
{
MainNode.Nodes.Add(ChildNode);
}
else
{
for (int i = 0; i <= MainNode.Nodes.Count; i++)
{
MainNode.Nodes.Add(ChildNode);
} }
if (!RootNode.Nodes.ContainsKey(MainNode.Name))
{
RootNode.Nodes.Add(MainNode);
} } } }
Code complexity is more here...(worst) Is there any other way of implementing
like Switch or any other methods.
|
|
|
|
|
Did Any body got any idea
|
|
|
|
|
Udayaraju wrote: Is there any other way of implementing
like Switch or any other methods.
create functions to break the processing up into smaller routines. For example:
if (table != null)
{
foreach (DataRow row in table.Rows)
{
MainNode = new TreeNode(row.ItemArray[0].ToString());
MainNode.Name = row.ItemArray[0].ToString();
ProcessRow(row, MainNode);
}
}
private void ProcessRow (DataRow row, TreeNode MainNode)
{
}
and then try to break up the ProcessRow function into smaller ones. This should make it easier to see what's going on and possibly reduce some code duplication.
Visual Studio has built in refactoring tools to help with this kind of thing. Try highlighting all of the text inside of the foreach loop, goto the "Refactor" menu of the main VS toolbar and select "Extract Method" to have VS help break up your functions.
|
|
|
|
|
|
If u see the above code I have problem here to fill the remaining Data.
Please trace these at
else
{
SubNode = new TreeNode(row.ItemArray[3].ToString));
SubNode.Name = row.ItemArray[3].ToString);
SubNode.Tag = row.ItemArray[2].ToString);
if (!ChildNode.Nodes.ContainsKeySubNode.Name))
{
ChildNode.Nodes.Add(SubNode);
} }
if (!MainNode.Nodes.ContainsKey(ChildNode.Name))
{
MainNode.Nodes.Add(ChildNode);
}
else
{
for (int i = 0; i <=MainNode.Nodes.Count;i++)
{
MainNode.Nodes.Add(ChildNode);
}
}
|
|
|
|
|
Here I am trying to do like these
Beverages
| |-Beers
| |-Bell Lager 500 ML
| |-CLUB PILSENER 500 ML
| |-Juices
| |-Apple Juice
| |-Chikooo Juice
|-Food
| |-MeatProducts
| |-GOAT MEAT
| |-Fruits
| |-APPLE GREEN
| |-LOCAL ORANGES
|-VegeTable |
| |-BEETROOT
| |-TOMATO FRESH
|
|
|
|
|
Hi Guys. I'm processing a bunch of files in a directory, approximately 650 files. I read each file into mem, search for "LONER" CR and replace that with a space. The search and replace works fine. However, after it has processed say 200 files it stops with the following error message. Does anybody know what it is and how I get it fixed. As you will see I am using ReadToEnd as this is the only way I can read the file inorder to correctly pick up the invalid character. I can't change this to ReadLine.
My Code:
private void button1_Click(object sender, EventArgs e)
{
string filepath;
filepath = textBox1.Text;
char[] ch = { '.', 't', 'x', 't' };
foreach (string f in Directory.GetFiles(filepath))
{
StreamReader sr = new StreamReader(f);
StreamWriter sw = new StreamWriter(Path.Combine(filepath, f.Trim(ch) + ".new"));
while (!sr.EndOfStream)
{
string holdLine = sr.ReadToEnd();
if (String.IsNullOrEmpty(holdLine))
continue;
string output = Regex.Replace(holdLine, "\r(?!\n)", " ");
sw.WriteLine(output);
}
sr.Close();
File.Move(f, f.Trim(ch) + ".done");
sw.Close();
Error Message:
ContextSwitchDeadlock was detected
Message: The CLR has been unable to transition from COM context 0x1a0970 to COM context 0x1a0ae0 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation without pumping Windows messages. This situation generally has a negative performance impact and may even lead to the application becoming non responsive or memory usage accumulating continually over time. To avoid this problem, all single threaded apartment (STA) threads should use pumping wait primitives (such as CoWaitForMultipleHandles) and routinely pump messages during long running operations.
Excellence is doing ordinary things extraordinarily well.
|
|
|
|