Thanks for the reply, not quite the answer I was hoping for, but thanks anyway. p.s. its not "homework" in the traditional sense but rather me attempting to expand my knowledge on my own time.
Just because we can; does not mean we should.
Thanks for the reply, not quite the answer I was hoping for, but thanks anyway. p.s. its not "homework" in the traditional sense but rather me attempting to expand my knowledge on my own time.
Just because we can; does not mean we should.
I would look at template fields in the GridView to achieve your desired view.
Just because we can; does not mean we should.
Just a quick question. Is this test logical or possible in ASP.NET? If so, under what scenario(s) would you expect to see such a positive result of the test. Thanks
if (Request.HttpMethod == "POST" && !IsPostBack)
{...}
Just because we can; does not mean we should.
When are app config settings for a windows service initialized. During a restart event? During a Start event? During OnContinue event? During Runtime? At install time? For example: OracleConnection oConn = new OracleConnection(ConfigurationManager.AppSettings["DatabaseConnection"].ToString()); is used at the time that its needed and is working. Currently I'm not making this call or similar in any of the service events. Should I be? When are you pro's assigning windows service config options? Whats the recommended way to handle config changes? p.s. If I've posted in the wrong forum, please flame away.
Just because we can; does not mean we should.
oConn equaling null would result in no data.
Just because we can; does not mean we should.
Im using the FtpWebRequest object to upload a file to an FTP server. The problem is that if a directory that is part of the remote path does not exist, it fails. Otherwise the file is upload with out error with the code below. I'd almost like to assume that since the request method is UploadFile, that it would create directories as needed. But I must be wrong. So is there be a way to accommodate dynamic creation of the directories? The Error Message [System.Net.WebException] = {"The remote server returned an error: (550) File unavailable (e.g., file not found, no access)."} Here's some code to review if you wish. The UriBuilder
UriBuilder uB = new UriBuilder();
uB.Scheme = Uri.UriSchemeFtp;
uB.Host = ConfigurationManager.AppSettings["FTPRemoteHost"].ToString();
uB.UserName = ConfigurationManager.AppSettings["FTPRemoteUser"].ToString();
uB.Password = ConfigurationManager.AppSettings["FTPRemotePass"].ToString();
FileInfo uFInfo = new FileInfo(localpdf);
uB.Path = remotepath + uFInfo.Name;
The value of the UriBuider Uri property
{ftp://username:password@myftpserver/existingDirectory/missingDirectory/mydocument.pdf}
The function I'm working with
public bool UploadFile(Uri serverUri, string localFile)
{
if (serverUri.Scheme != Uri.UriSchemeFtp)
return false;
FtpWebRequest request = (FtpWebRequest)WebRequest.Create(serverUri);
request.Method = WebRequestMethods.Ftp.UploadFile;
request.UseBinary = true;
if (File.Exists(localFile) == false)
return false;
StreamReader sourceStream = new StreamReader(localFile);
byte\[\] fileContents = Encoding.UTF8.GetBytes(sourceStream.ReadToEnd());
sourceStream.Close();
if (fileContents.Length <= 0)
return false;
request.ContentLength = fileContents.Length;
try
{
Stream requestStream = request.GetRequestStream();
requestStream.Write(fileContents, 0, fileContents.Length);
requestStream.Close();
}
catch (Exception ex)
{
Debug.WriteLine(ex.Message);
return false;
}
FtpWebResponse response = (FtpWebResponse)request.GetResponse();
#if(DEBUG)
WriteEvent(response.StatusDescription, EventLogEntryType.Information);
#endif
Might need to have some of those dll's your talking about to be registered with regsrv.exe. But I guess that depends on the dll's your using and your deployment method.
Just because we can; does not mean we should.
Also your shellExecute.Verb should be "open". List of Verbs - http://msdn.microsoft.com/en-us/library/bb762153(VS.85).aspx[^]
Just because we can; does not mean we should.
Don't forget that when storing a date string in Access it needs to be prefixed and suffixed with "#".
Just because we can; does not mean we should.
Using the DateTime and TimeSpan objects. http://msdn.microsoft.com/en-us/library/system.datetime.aspx[^] and http://msdn.microsoft.com/en-us/library/system.timespan.aspx[^]
//Create a TimeSpan object to hold Overall Time
TimeSpan Overall = new TimeSpan(0,0,0);
for (int i = 0; i < NumberOfRounds; i++)
{
//Each round has a start and end time
DateTime Start = DateTime.Now;
// Round plays out
DateTime End = DateTime.Now;
TimeSpan TimeOfRound = End.Subtract(Start);
Overall.Add(TimeOfRound);
}
Just because we can; does not mean we should.
Check the state of the checkbox and use the appropriate operator.
if(checkbox1.checked)
price += Convert.ToDouble(dgw.Cells[6].Value.ToString());
else
price -= Convert.ToDouble(dgw.Cells[6].Value.ToString());
Just because we can; does not mean we should.
So I have a project that I've been working on, its a simple form that takes some input, then formats the text on a Word document. I've come close to being able to format the text in a pyramid shape, but it fails when the text is not pre-canned to fit in that shape. Pre-canned text might contain 4 paragraphs, with each paragraph containing more text than the previous. This has been fairly easy to set using constant values for right & left gutters, margins and so forth. Non-canned text is unknown, might have 2 paragraphs, might have 8 paragraphs and the first one containing more than the 3rd but less than the 5th. Its completely unknown. I've searched google and did not find an answer. Question: Is there a formula that can be used to format an unknown amount of text into a pyramid shape? Thanks
Just because we can; does not mean we should.
Not sure where your having problems. I did this test and had no problems getting the notifications. Sorry
private void Form1\_Load(object sender, EventArgs e)
{
fileSystemWatcher1 = new System.IO.FileSystemWatcher(@"C:\\");
fileSystemWatcher1.IncludeSubdirectories = false;
fileSystemWatcher1.NotifyFilter = NotifyFilters.FileName;
fileSystemWatcher1.Filter = "\*.abcd";
fileSystemWatcher1.Created += new System.IO.FileSystemEventHandler(fileSystemWatcher1\_Created);
fileSystemWatcher1.Changed += new System.IO.FileSystemEventHandler(fileSystemWatcher1\_Changed);
fileSystemWatcher1.Renamed += new RenamedEventHandler(fileSystemWatcher1\_Renamed);
fileSystemWatcher1.Deleted += new FileSystemEventHandler(fileSystemWatcher1\_Deleted);
fileSystemWatcher1.EnableRaisingEvents = true;
File.Delete(@"C:\\test.abcd");
StreamWriter sw = new StreamWriter(@"C:\\test.abcd",true);
sw.WriteLine("test");
sw.Close();
sw.Dispose();
}
void fileSystemWatcher1\_Deleted(object sender, FileSystemEventArgs e)
{
MessageBox.Show("File Deleted " + e.FullPath.ToString());
}
void fileSystemWatcher1\_Renamed(object sender, RenamedEventArgs e)
{
MessageBox.Show("File Renamed " + e.FullPath.ToString());
}
void fileSystemWatcher1\_Changed(object sender, System.IO.FileSystemEventArgs e)
{
MessageBox.Show("File Changed " + e.FullPath.ToString());
}
void fileSystemWatcher1\_Created(object sender, System.IO.FileSystemEventArgs e)
{
MessageBox.Show("File Created " + e.FullPath.ToString());
}
Just because we can; does not mean we should.
You should read up on the Microsoft primary interop assemblies. Office 2007 - http://www.microsoft.com/downloads/details.aspx?familyid=59DAEBAA-BED4-4282-A28C-B864D8BFA513&displaylang=en[^] Office XP - http://www.microsoft.com/downloads/details.aspx?FamilyId=C41BD61E-3060-4F71-A6B4-01FEBA508E52&displaylang=en[^]
Just because we can; does not mean we should.
In regards to measuring your text, you could just add a constant value to the total width assuming the size of the button does not change.
Just because we can; does not mean we should.
FSW monitors a directory for file creation, modification, deletion and renaming. The custom expression is to monitor only those file types that match that expression. This example monitors only the directory where dir == the directory to monitor and only raise an event on file types of txt.
fileWatcher = new FileSystemWatcher(dir, "*.txt");
fileWatcher.EnableRaisingEvents = false;
fileWatcher.IncludeSubdirectories = false;
fileWatcher.NotifyFilter = NotifyFilters.FileName;
fileWatcher.Created += new FileSystemEventHandler(fileWatcher_Created);
Set fileWatcher.EnableRaisingEvents = true to enable the monitoring. To stop monitoring set the value to false. http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx[^]
Just because we can; does not mean we should.
Thank you
Just because we can; does not mean we should.
Hi, Can a windows service run a console application? Basically my goal is to have a windows service with a FileSystemWatcher monitor a directory. If that directory has any MS Word documents in it, convert them to pdf and then move them to their final resting place. I've created the windows service, it finds the files and starts a MS Word in the background. But on the line that opens a document, it fails. I presume because its running from a windows service and MS Word is probably trying to display some dialog. So my thinking is that if I move the conversion functionality to a console app and just let the windows service do the monitoring it will work. Thanks for the feedback!
Just because we can; does not mean we should.
Since this is a console app, you could just create a batch file to run your program as who ever with the runas command. That way you don't need to have have to modify your code.
Just because we can; does not mean we should.
It could be possible with the web browser control. http://msdn.microsoft.com/en-us/library/2te2y1x6.aspx[^] pseduo code fetch page -> store source code Timer ticks off and triggers event fetch page -> store source code compare previous code to new code; if different do something
Just because we can; does not mean we should.