|
No. (As you would have found out if you had tried it.)
You can't have the same name fro a class and a class member (which the nested class is assumed to be). The compiler will complain.
You can have:
class a : b
{
class c
{
}
} If Barbie is so popular, why do you have to buy her friends?
Eagles may soar, but weasels don't get sucked into jet engines.
If at first you don't succeed, destroy all evidence that you tried.
|
|
|
|
|
yes i do know that Nested class name cannot be as same as its holding class, but when i tried to Decompile a DLL it show similar kind of code inside that,
Any idea on that
|
|
|
|
|
A nested class can contain anything, methods, fields, properties, events, etc.
I think I do not understand what you are having a problem with.
Can you try explaining what you are trying to do or having a problem with in more detail, please?If Barbie is so popular, why do you have to buy her friends?
Eagles may soar, but weasels don't get sucked into jet engines.
If at first you don't succeed, destroy all evidence that you tried.
|
|
|
|
|
When I publish my C# application using Visual Studio Express, and install it, it creates a ClickOnce Application Reference file on the desktop and in the Start Menu instead of just a normal .EXE file - and this is screwing up my File Associations. Could someone kindly suggest how I could have txt files etc opened in my application when dealing with Application Reference files?
Thank you
|
|
|
|
|
The real .exe file will be stored somewhere in the user's AppData folder (I think).
Why not have the associations set on first startup of the program? You could have your software enter the details in to the registry (note: potential permissions/UAC problem) as it will know exactly where it is.
|
|
|
|
|
Thank you - I have searched my entire hard drive in every possible place that there would be an executable file but have not found any. I even checked the AppData folder. Nothing at all. Just a bunch of ClickOnce Application Reference icons.
I also tried setting registry info for the associations on startup and it has been unsuccessful. I don't get any errors at all... It just doesn't work.
I've also (originally) tried using the File Association dialog that's inside the Publish page where you publish the project and entered ProgID info and icons etc and that approach hasn't worked either. But, funny thing... The custom Icons I used in the File Association dialog in VS are showing up on the files... My app just isn't loading the content of the files that are being double-clicked.
|
|
|
|
|
I have the following code:
using System;
using System.IO;
using System.Xml;
public class Sample {
public static void Main() {
string strQuery;
XmlDocument doc = new XmlDocument();
doc.Load("booksort.xml");
XmlNode book;
XmlNode root = doc.DocumentElement;
book=root.SelectSingleNode(strQuery);
}
}
In the call to SelectSingleNode, how do i formulate my strQuery so that I get the FileValue2 (in this case it is 'swethrhbfb') where FileValue1="00000002.dat"
Many thanks!
<?xml version="1.0" encoding="utf-8"?>
<MyObjects xmlns="urn:deployment-manifest-schema">
<MyObject Id="a36ef512-e9a1-48f7-9153-690f58485290" ObjectType="SPFile" ParentId="5636396a-9319-45fd-a1e0-b2eb8eb5812c" ParentWebId="db611ace-9940-4602-8f44-140fcaaa479d" ParentWebUrl="esgawesodtegklas" Url="dfhgjnsdfhjdthksrtfhyasefhb">
<File Url="efhsbertyhsehgh/ryjseryghdrfh.xml" Id="a36ef512-e9a1-48f7-9153-690f58485290" ParentWebId="db611ace-9940-4602-8f44-140fcaaa479d" ParentWebUrl="tjketyaehthfyh" Name="erygawrygesrfh" >
<Versions>
<File Url="tukjseryhsdrtgjdtyhm" ParentWebId="db611ace-9940-4602-8f44-140fcaaa479d" Name="rfghjsetrhyusrtgbn" Id="a36ef512-e9a1-48f7-9153-690f58485290" FileValue1="00000000.dat" FileValue2="45tyw4trgh" FileValue3="eygegefgsd">
</File>
<File Url="tukjseryhsdrtgjdtyhm" ParentWebId="db611ace-9940-4602-8f44-140fcaaa479d" Name="rfghjsetrhyusrtgbn" Id="a36ef512-e9a1-48f7-9153-690f58485290" FileValue1="00000001.dat" FileValue2="sertherfbf" FileValue3="ertegsrths">
</File>
<File Url="tukjseryhsdrtgjdtyhm" ParentWebId="db611ace-9940-4602-8f44-140fcaaa479d" Name="rfghjsetrhyusrtgbn" Id="a36ef512-e9a1-48f7-9153-690f58485290" FileValue1="00000002.dat" FileValue2="swethrhbfb" FileValue3="tryeyerhrh">
</File>
<File Url="tukjseryhsdrtgjdtyhm" ParentWebId="db611ace-9940-4602-8f44-140fcaaa479d" Name="rfghjsetrhyusrtgbn" Id="a36ef512-e9a1-48f7-9153-690f58485290" FileValue1="00000003.dat" FileValue2="drtyerysey" FileValue3="drjdrgndrg">
</File>
<File Url="tukjseryhsdrtgjdtyhm" ParentWebId="db611ace-9940-4602-8f44-140fcaaa479d" Name="rfghjsetrhyusrtgbn" Id="a36ef512-e9a1-48f7-9153-690f58485290" FileValue1="00000004.dat" FileValue2="eryeryaery" FileValue3="rthrhsrths">
</File>
<File Url="tukjseryhsdrtgjdtyhm" ParentWebId="db611ace-9940-4602-8f44-140fcaaa479d" Name="rfghjsetrhyusrtgbn" Id="a36ef512-e9a1-48f7-9153-690f58485290" FileValue1="00000005.dat" FileValue2="tyudtyufud" FileValue3="tyjnfghjdf">
</File>
<File Url="tukjseryhsdrtgjdtyhm" ParentWebId="db611ace-9940-4602-8f44-140fcaaa479d" Name="rfghjsetrhyusrtgbn" Id="a36ef512-e9a1-48f7-9153-690f58485290" FileValue1="00000006.dat" FileValue2="werawerase" FileValue3="gfhjndfhjd">
</File>
</Versions>
</File>
</MyObject>
</MyObjects> ----------------------------------------------------------
Lorem ipsum dolor sit amet.
modified on Wednesday, February 10, 2010 8:20 AM
|
|
|
|
|
Hi all, i need helping about
<code>if (pcap_addr.Addr != IntPtr.Zero)</</code>
is that mean (at C++):
<code>if (pcap_addr.Addr != null)</code>
|
|
|
|
|
MSDN[^] says "The value of this field is not equivalent to a null reference"
So, not quite, but similar.If Barbie is so popular, why do you have to buy her friends?
Eagles may soar, but weasels don't get sucked into jet engines.
If at first you don't succeed, destroy all evidence that you tried.
|
|
|
|
|
I would read the first as there is/was "something", but it is not valid.
The second is more like, there is "nothing" or "not applicable", not applicable is even more correct I think.V.
|
|
|
|
|
Hi all, i read that but don't understand it, can you illustrate it to me, pleae,,.
<pre>[SuppressUnmanagedCodeSecurityAttribute]</pre>
// Allows managed code to call into unmanaged code without a stack walk.
// 1- This attribute can be applied to methods that want to call into native
// code without incurring the performance loss of a run-time security check when doing so.
// 2- Using this attribute in a class applies it to all contained methods.
regards..,
|
|
|
|
|
This just basically means what it says:
Increase performance when using pInvoke, but make sure to deal with the security issues that follows.
Every method in a class decorated with this attribute also gets the attribute.
|
|
|
|
|
helo,
i want to create a process,that if i click log-off to my user is still running and working.
how i do it?services?system process?Special process?
I would be happy to detail some.
Me.
|
|
|
|
|
Windows Service would be the way to go, set to 'automatic' to get it to start when the computer does, and probably using the local system account. Regards,
Rob Philpott.
|
|
|
|
|
Yes, a Windows (NT) Service is the way to go here. There are plenty of articles on how to create one so google will provide you with many of relevant answers on this matter. Good luck!
|
|
|
|
|
A Windows Scheduled Task might do it as well.
|
|
|
|
|
Hi,
I would like to use Multi threading to improve the performance. I have a datatable it may have any no of records. But the problems is i have to split those records and assign some records to one thread, some other records to other thread and so on.
I will pass the table,no of threads, records for thread like the following
public void MultiThreadingSample(DataTable table, int noOfThreads,int recordsForThread)
{
}
please help to me.
|
|
|
|
|
Hi Guys. I have a slight problem. I have written an app that processes various types of files. I create a Thread for each type of file being processed depending on a checkbox being checked.
Now, from each file processed I output totals to a label on the form. However, this only seems to work for the first two files being processed and the remainder does not get their totals output to the labels. Is this a known issue and is there a way I can get around this? The code is kinda long so don't really want to add any here now. But the process flow of the program is such.
1) User selects a searches for file to process.
2) User checks the appropriate checkbox.
3) Thread is started calling the block of code to run.
4) Once file is processed finalize by calling GC.Collect().
if user wants to process another file he unchecks the current chechbox, checks a new checkbox and searches for new file and above process is followed calling the appropriate Thread to run.
Can somebody advise why when running more than two "Thread" processes in succession results in the third and fourth not outputting totals to the Label's?Excellence is doing ordinary things extraordinarily well.
|
|
|
|
|
Without some idea of the code it is really difficult to suggest anything, but there general things you can check:
Are the thread running at all? Add some logging to a file to record what is being done, and in what order.
Are the output overwriting each other? Try logging the outputs as well.
Are the thread having problems with conflicts? Are there any locks which might be waiting?
Is it always the same threads that don't run? Or does that change depending on what order they are started in, say?
Sorry not to give concrete answers, but there is a heck of a lot that could be going wrong here - I think your first call is to gather more info!If Barbie is so popular, why do you have to buy her friends?
Eagles may soar, but weasels don't get sucked into jet engines.
If at first you don't succeed, destroy all evidence that you tried.
|
|
|
|
|
Hi Griff. The Threads are all running. Output is created from all the Threads. However, I display some totals on screen for the user to verify against. It will output the totals for two of the threads run after each other, but when running the third and fourth thread I get no totals output to screen. I have tested by adding the totals to a messagebox after it is supposed to be output to the label and that works.
Below is the code. It might be long but this is what I have.
#region Set Text Code
public delegate void SetText(Control ctrl, string str);
public delegate void SetLabel(Control lblctrl, string filename);
private delegate void updateBar();
private void setText(Control ctrl, string str)
{
if (this.WindowState == FormWindowState.Minimized)
return;
if (ctrl.InvokeRequired)
ctrl.BeginInvoke(new SetText(setText), new object[] { ctrl, str });
else
ctrl.Text = str;
}
private void setFilename(Control lblctrl, string filename)
{
if (this.WindowState == FormWindowState.Minimized)
return;
if (lblctrl.InvokeRequired)
lblctrl.BeginInvoke(new SetLabel(setFilename), new object[] { lblctrl, filename });
else
lblctrl.Text = filename;
}
private void finalizeProcess()
{
GC.Collect();
}
#endregion
#region Open File Dialog Code
private void button3_Click(object sender, EventArgs e)
{
if (openFileDialog1.ShowDialog() != DialogResult.OK)
{
return;
}
else
{
txtboxSelectFile.Text = openFileDialog1.FileName;
}
}
#endregion
#region Select File Code
private void btnStart_Click(object sender, EventArgs e)
{
setText(this, "Checking Process Selection");
if (chkboxHolders.CheckState == CheckState.Unchecked && chkboxCert.CheckState == CheckState.Unchecked &&
chkboxPiadd.CheckState == CheckState.Unchecked && chkboxDivRecords.CheckState == CheckState.Unchecked)
{
MessageBox.Show("Please make a valid processing selection", "Invalid Process Selection",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
{
if (chkboxHolders.Checked)
{
setText(this, "Holder File Processing Selected");
processHolders();
}
if (chkboxCert.Checked)
{
setText(this, "Certificate File Processing Selected");
processCerts();
}
if (chkboxPiadd.Checked)
{
setText(this, "Payment Instruction File Processing Selected");
processDiv();
}
if (chkboxDivRecords.Checked)
{
setText(this, "Create Dividend Files");
processDividends();
}
}
}
#endregion
#region All Threading Code
private void processHolders()
{
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
ThreadStart starthld = new ThreadStart(convertHolders);
Thread threadhld = new Thread(starthld);
threadhld.Start();
}
}
private void processCerts()
{
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
ThreadStart startcert = new ThreadStart(convertCert);
Thread threadcert = new Thread(startcert);
threadcert.Start();
}
}
private void processDiv()
{
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
ThreadStart startdiv = new ThreadStart(convertDiv);
Thread threaddiv = new Thread(startdiv);
threaddiv.Start();
}
}
private void processDividends()
{
if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
{
ThreadStart startdivs = new ThreadStart(convertDividendPayments);
Thread threaddivs = new Thread(startdivs);
threaddivs.Start();
}
}
#endregion
#region All Processing Code
private void convertHolders()
{
string infile;
infile = txtboxSelectFile.Text;
string outfile;
outfile = saveFileDialog1.FileName;
string holdline;
StreamReader sr = new StreamReader(infile);
StreamWriter sw = new StreamWriter(outfile);
setText(this, "Start Holder File Conversion");
int holdercount = 0;
Int64 currentbal = 0;
Int64 oldbal = 0;
long ShareTotal = 0;
long ShareOld = 0;
while (!sr.EndOfStream)
{
holdline = sr.ReadLine();
string HID = holdline.Substring(0, 10);
string Title = holdline.Substring(10, 45).Trim();
string Surname = holdline.Substring(55, 100).Trim();
string FirstName = holdline.Substring(155, 100).Trim();
string OtherNames = holdline.Substring(255, 100).TrimEnd();
string Gender = holdline.Substring(355, 1);
string Addr1 = holdline.Substring(356, 35).TrimEnd();
string Addr2 = holdline.Substring(396, 35).TrimEnd();
string Addr3 = holdline.Substring(436, 35).TrimEnd();
string Addr4 = holdline.Substring(476, 35).TrimEnd();
string Addr5 = holdline.Substring(516, 35).TrimEnd();
string PostCode = holdline.Substring(556, 10).TrimEnd();
string Nationality = holdline.Substring(566, 25).TrimEnd();
string BranchCode = holdline.Substring(591, 6);
string AccountNumber = holdline.Substring(597, 16);
string AccountType = holdline.Substring(613, 2);
string NationalId = holdline.Substring(615, 16).TrimEnd();
string TotalShares = holdline.Substring(631, 18);
string FullName = Title + " " + FirstName + " " + Surname;
int namelen = FullName.Length;
int namerem = namelen - 35;
currentbal = Convert.ToInt64(TotalShares);
string OldBalance = holdline.Substring(649, 18);
oldbal = Convert.ToInt64(OldBalance);
setText(this, "Processing HolderID: " + HID);
if(namelen > 35)
{
sw.Write(" ".PadRight(5, ' ') + "NAADD" + " ".PadRight(7, ' ') + "C" + HID +
FullName.Substring(0, 35).PadRight(35, ' ') + FullName.Substring(35, namerem).PadRight(35, ' ') +
Addr1.PadRight(35, ' ') + Addr2.PadRight(35, ' ') + Addr3.PadRight(35, ' ') + Addr4.PadRight(35, ' ') +
Addr5.PadRight(35, ' ') + " ".PadRight(35, ' ') + PostCode.PadRight(5, ' ') + "ZAF" +
"IND" + " ".PadRight(57, ' ') + HID.PadRight(12, ' ') + " ".PadRight(13, ' '));
}
else if (namelen <= 35)
{
sw.Write(" ".PadRight(5, ' ') + "NAADD" + " ".PadRight(7, ' ') + "C" + HID + FullName.Trim().PadRight(35, ' ') +
Addr1.PadRight(35, ' ') + Addr2.PadRight(35, ' ') + Addr3.PadRight(35, ' ') + Addr4.PadRight(35, ' ') +
Addr5.PadRight(35, ' ') + " ".PadRight(70, ' ') + PostCode.PadRight(5, ' ') + "ZAF" +
"IND" + " ".PadRight(57, ' ') + HID.PadRight(12, ' ') + " ".PadRight(13, ' '));
}
if (NationalId == "" || NationalId.Length < 13)
{
sw.Write(" ".PadRight(1142, ' ') + " ".PadRight(1456, ' ') + Environment.NewLine);
}
else
{
sw.Write("Z" + NationalId.PadRight(16, ' ') + " ".PadRight(1125, ' ') + " ".PadRight(1456, ' ') + Environment.NewLine);
}
ShareTotal = ShareTotal + currentbal;
ShareOld = ShareOld + oldbal;
holdercount++;
}
sr.Close();
sw.Close();
setFilename(lblShareTotals, ShareTotal.ToString());
setFilename(lblHolderTotal, holdercount.ToString());
setFilename(lblOldBalanceTotals, ShareOld.ToString());
this.progressBar1.Invoke(new updateBar(this.finalizeProcess));
MessageBox.Show("Completed Processing Holder File", "Holder File Completed",
MessageBoxButtons.OK, MessageBoxIcon.Information);
setText(this, "Holder File Processing Completed");
}
private void convertCert()
{
string infile;
infile = txtboxSelectFile.Text;
string outfile;
outfile = saveFileDialog1.FileName;
string holdline;
Int64 currentbal = 0;
long ShareTotal = 0;
int totaltrans = 0;
StreamReader sr = new StreamReader(infile);
StreamWriter sw = new StreamWriter(outfile);
setText(this, "Start Certificate File Conversion");
while (!sr.EndOfStream)
{
holdline = sr.ReadLine();
string HID = holdline.Substring(0, 10);
string day = holdline.Substring(10, 2);
string month = holdline.Substring(13, 2);
string year = holdline.Substring(16, 4);
string cert = holdline.Substring(20, 10).Trim();
string transaction = holdline.Substring(30, 55).TrimEnd();
string shares = holdline.Substring(85, 18);
setText(this, "Processing HolderID: " + HID);
if (chkoxCreateCerts.Checked)
{
if (shares != "000000000000000000")
{
sw.WriteLine(" ".PadRight(5, ' ') + "CAPIN" + " ".PadRight(8, ' ') +
day + month + year.Substring(2, 2) + "+" + shares.Substring(4, 14) + "000000" +
"ORD" + "ZAF" + " ".PadRight(5, ' ') + "C" + HID + " ".PadRight(10, ' ') +
cert.PadLeft(12, '0') + " ".PadRight(2911, ' '));
currentbal = Convert.ToInt64(shares);
ShareTotal = ShareTotal + currentbal;
}
}
else
{
if (shares != "000000000000000000")
{
sw.WriteLine(" ".PadRight(5, ' ') + "ADJIN" + " ".PadRight(8, ' ') +
day + month + year.Substring(2, 2) + "+" + shares.Substring(4, 14) + "000000" +
"ORD" + "ZAF" + " ".PadRight(5, ' ') + "C" + HID + " ".PadRight(10, ' ') +
cert.PadLeft(12, '0') + " ".PadRight(2911, ' '));
currentbal = Convert.ToInt64(shares);
ShareTotal = ShareTotal + currentbal;
}
}
totaltrans++;
}
setFilename(lblCertificateTotals, totaltrans.ToString());
setFilename(lblCertificateBalance, ShareTotal.ToString());
sr.Close();
sw.Close();
this.progressBar1.Invoke(new updateBar(this.finalizeProcess));
MessageBox.Show("Completed Processing Certificate File", "Certificate File Completed",
MessageBoxButtons.OK, MessageBoxIcon.Information);
setText(this, "Certificate File Processing Completed");
}
private void convertDiv()
{
string infile;
infile = txtboxSelectFile.Text;
string outfile;
outfile = saveFileDialog1.FileName;
string holdline;
int totalCount = 0;
StreamReader sr = new StreamReader(infile);
StreamWriter swb = new StreamWriter(outfile);
setText(this, "Start Payment Instruction Conversion");
while (!sr.EndOfStream)
{
holdline = sr.ReadLine();
string HID = holdline.Substring(0, 10);
string BranchCode = holdline.Substring(591, 6);
string AccountNumber = holdline.Substring(597, 16);
string shares = holdline.Substring(85, 18);
string newBranch = BranchCode.Substring(0, 3) + "-" + BranchCode.Substring(3, 3);
setText(this, "Processing HolderID: " + HID);
if (BranchCode != " ")
{
if (shares != "000000000000000000")
{
swb.WriteLine(" ".PadRight(5, ' ') + "PIADD" + " ".PadRight(7, ' ') + "C" + HID + "10" +
"D" + " " + newBranch.PadRight(10, ' ') + AccountNumber.PadRight(16, ' ') + " ".PadRight(2940, ' '));
totalCount++;
}
}
}
sr.Close();
swb.Close();
setFilename(lblPaymentInstrucTotals, totalCount.ToString());
this.progressBar1.Invoke(new updateBar(this.finalizeProcess));
MessageBox.Show("Completed PIADD Conversion", "PIADD Conversion Message",
MessageBoxButtons.OK, MessageBoxIcon.Information);
setText(this, "Payment Instruction File Processing Completed");
}
private void convertDividendPayments()
{
string filePath;
string inFile;
string holdLine;
inFile = txtboxSelectFile.Text;
filePath = folderBrowserDialog1.SelectedPath;
long TotalGross = 0;
long TotalTax = 0;
long TotalNet = 0;
Int64 gross = 0;
Int64 tax = 0;
Int64 net = 0;
StreamReader sr = new StreamReader(inFile);
StreamWriter swp = new StreamWriter(Path.Combine(filePath, "er_au_xxxx_seqmpd.temp"));
setText(this, "Starting Payment File Conversions");
while (!sr.EndOfStream)
{
holdLine = sr.ReadLine();
string DividendNumber = holdLine.Substring(0, 9).TrimEnd();
string CADescription = holdLine.Substring(9, 55);
string HolderRef = holdLine.Substring(64, 10);
string PaymentType = holdLine.Substring(74, 1);
string PaymentRef = holdLine.Substring(75, 10);
string LdrBal = holdLine.Substring(85, 18);
string GrossAmount = holdLine.Substring(103, 18);
string TaxAmount = holdLine.Substring(121, 18);
string NetAmount = holdLine.Substring(139, 18);
string PaymentStatus = holdLine.Substring(157, 1);
string PaymentDate = holdLine.Substring(158, 10);
gross = Convert.ToInt64(GrossAmount);
tax = Convert.ToInt64(TaxAmount);
net = Convert.ToInt64(NetAmount);
setText(this, "Processing HolderID: " + HolderRef);
swp.Write("C" + HolderRef + "DIV" + DividendNumber + PaymentRef.Substring(2, 8).PadLeft(8, '0'));
if (PaymentType == "E")
{
swp.Write("D" + PaymentDate.Substring(0, 2) + PaymentDate.Substring(3, 2) + PaymentDate.Substring(6, 4));
}
else
{
swp.Write(PaymentType + " ".PadRight(8, ' '));
}
swp.Write(GrossAmount.Substring(7, 11) + "00" + TaxAmount.Substring(7, 11) + "00" + NetAmount.Substring(7, 11) + "00" + "S");
if (PaymentStatus == "P")
{
swp.Write("2");
}
if (PaymentStatus == "C")
{
swp.Write("3");
}
if (PaymentStatus == "U")
{
swp.Write("1");
}
if (PaymentStatus == "R")
{
swp.Write("E");
}
swp.Write("R" + " ".PadRight(24, ' ') + Environment.NewLine);
TotalGross = TotalGross + gross;
TotalTax = TotalTax + tax;
TotalNet = TotalNet + net;
}
sr.Close();
swp.Close();
setFilename(lblGrossTotals, TotalGross.ToString());
setFilename(lblTaxTotals, TotalTax.ToString());
setFilename(lblNetTotals, TotalNet.ToString());
this.progressBar1.Invoke(new updateBar(this.finalizeProcess));
MessageBox.Show("Completed Dividend Payment Processing", "Dividend Processing",
MessageBoxButtons.OK, MessageBoxIcon.Information);
setText(this, "Dividend File Processing Completed");
}
#endregion
Excellence is doing ordinary things extraordinarily well.
|
|
|
|
|
Without actually running it, I can't see anything obviously wrong.
Since this is the code that (doesn't) show the problem, I would be tempted to try
private void setFilename(Control lblctrl, string filename)
{
Console.WriteLine("setFileName Entered: " + lblCtrl.Name + " : " + filename);
if (this.WindowState == FormWindowState.Minimized)
return;
Console.WriteLine("setFileName PreInvokeCheck: " + lblCtrl.Name + " : " + filename);
if (lblctrl.InvokeRequired)
{
Console.WriteLine("setFileName BeginInvoke: " + lblCtrl.Name + " : " + filename);
lblctrl.BeginInvoke(new SetLabel(setFilename), new object[] { lblctrl, filename });
}
else
{
Console.WriteLine("setFileName Direct: " + lblCtrl.Name + " : " + filename);
lblctrl.Text = filename;
}
}
Or equivilent to check if it gets to the "setFileName Direct" bit when you don't get the label written. It may give a clue to what is going on (or worse, remove the problem)If Barbie is so popular, why do you have to buy her friends?
Eagles may soar, but weasels don't get sucked into jet engines.
If at first you don't succeed, destroy all evidence that you tried.
|
|
|
|
|
Thanks mate. I will give it a go and post back. It is just strange that it does it for two consecutive runs but for the third and fourth it doesn't. And it doesn't matter in what order it is run or not. Excellence is doing ordinary things extraordinarily well.
|
|
|
|
|
Hi,
you are not supposed to touch a Control from a thread that did not create the Control. While your code is using several InvokeRequired/Invoke patterns, it is also not using them in several locations, see:
1.
if (this.WindowState == FormWindowState.Minimized)
is probably OK, but not documented to be OK
2.
infile = txtboxSelectFile.Text;
is probably not OK (not documented, I guess it is not OK for Controls that allow text editing)
3.
outfile = saveFileDialog1.FileName;
is most likely not OK, file dialogs are known to be critical (e.g. you need STAThread for them)
IMO you should fix all of the above.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
|
|
|
|
|
Hi Guys,
I'm trying to do something that looks easy but for some reason doesn't work.
I have a window service which loads .dll's that are in a different directory every couple of minutes.
I need to update those .dll's every now an than so I created an AppDomin and from there I want to load the .dll's in to the main AppDomain.
The strange thing is when I try to load a .dll I get an exception that the .dll can't be found.
Here's the source code:
AppDomainSetup AppDomSetup = new AppDomainSetup();
AppDomSetup.ApplicationName = "Service Name";
AppDomSetup.ApplicationBase = Application.StartupPath;
AppDomSetup.PrivateBinPath = "alerts";
AppDomSetup.ShadowCopyFiles = "true";
AppDomSetup.CachePath = Path.Combine(Application.StartupPath, "_cache");
m_FilesDomain = AppDomain.CreateDomain("Ksm Scheduler", null , AppDomSetup);
m_FilesDomain.Load("alert1.dll");
The 'PrivateBinPath' property points to the directory that contains the .dll's.
The 'cache path' folder IS CREATED but I get an exception. When I place the .dll's in the 'ApplicationBase' directory i.e. in the directory of the .exe file, the .dll is loaded.
Thanks for any help,
Avi
|
|
|
|
|
Don't have an answer to your immediate questions, but a couple of queries. Firstly, are all these DLLs .NET assemblies? Are you using shadowing so you don't lock the file in question so it can be altered elsewhere? When a dll is changed, do you want to unload the last one and replace it with the new one?
The bit which sounds really odd is loading the dll into the main application domain (which you can't unload). Do you not want to create a new domain, load the dlls in there and then unload it when they need to be updated?Regards,
Rob Philpott.
|
|
|
|
|