|
There isn't a specific method call to do this. I suspect you can achieve it using a window message of some kind. But I don't know which one.
Look at the DateTimePicker class in reflector. You need to trigger the WmDropDown method (which is private).
This is called from the WmRelfectCommand method, which is called from the WndProc method.
You can use SendMessage[^] to transmit messages to a controls message queue, which will be processed by WndProc.
Maybe some else knows what message values you need to transmit. It's likely to be a base message + the WM_REFLECT message. http://www.tech-archive.net/Archive/VC/microsoft.public.vc.language/2005-08/msg00589.html[^]
Sorry I can't be more helpful.
Simon
|
|
|
|
|
Track the window message for mouse down ans mouse up and check if the active control is datetimepicker. If it is then do as required. I hope this helps.
C isn't that hard: void (*(*f[])())() defines f as an array of unspecified size, of pointers to functions that return pointers to functions that return void
"Always program as if the person who will be maintaining your program is a violent psychopath that knows where you live." - Martin Golding
|
|
|
|
|
Where can I download "msword.olb"
Hello Friends
|
|
|
|
|
Google ? I'd guess it's either part of Word or part of the Word toolkit.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hi all,
im having a problem with retrieving a binary file from the database and reading it in my code, so far i have this:
byte AttachmentByte = new byte();
AttachmentByte = StringToByteArray(inputString);
and a function to convert it:
public static byte[] StringToByteArray(string inputString)
{
System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
return encoding.GetBytes(inputString);
}
but when i run it i get the error:
Cannot implicitly convert type 'byte[]' to 'byte'
can someone please tell me what im doing wrong.
thanks in advance!
living life on the flip side
|
|
|
|
|
StringToByteArray returns byte[] while AttachmentByte is defined as byte.
|
|
|
|
|
Agweet wrote: byte AttachmentByte = new byte();
AttachmentByte = StringToByteArray(inputString);
byte[] AttachmentByte;
AttachmentByte = StringToByteArray(inputString);
|
|
|
|
|
Hi guys,
thanks for the quick replies,
the problem is that i tried using:
byte[] AttachmentByte;
then it gives the error on the filestream:
using (System.IO.FileStream fs = System.IO.File.Create(newPath))
{
fs.WriteByte(AttachmentByte);
}
i get the errors:
The best overloaded method match for 'System.IO.Stream.WriteByte(byte)' has some invalid arguments
Argument '1': cannot convert from 'byte[]' to 'byte'
is there something else im missing?
living life on the flip side
|
|
|
|
|
Agweet wrote: is there something else im missing?
Yes. A good C# book.
Seriously, the error message you got is self explanatory. It has some invalid arguments. Look at the documentation for that method and see what arguments it expects. BTW, this some different code you are showing than the one given in the original post.
|
|
|
|
|
thanks once again for the reply, i know that i posted other code...im trying to retrieve a binary file stored in the database and write it to my local machine, with use of creating a folder and using a filestream.
thanks for all the advise
living life on the flip side
|
|
|
|
|
WriteByte writes just a single byte to the stream but you need to write byte[] so use the overload that writes byte[] to the stream. That's it
|
|
|
|
|
Hi Giorgi,
sorry but i have never used filestreams or binary files before, how would i go about using the overload that writes byte[]?
living life on the flip side
|
|
|
|
|
As suggested by Navaneeth you need a good C# book. As for FileStream, you can have a look at its method at this msdn link: FileStream Methods[^]
|
|
|
|
|
Hi Giorgi,
thanks for everything, to all the people that replied
living life on the flip side
|
|
|
|
|
hi,
in my application i need to upload the data to the serevr using ftpwebrequest method .I need to upload 2 files one is a zip file (more than 10 MB) and other is a text file to the same server. when iam uploading total zip content is not getting uploaded to the serevr and its returning error like
" The underlying connection was closed: An unexpected error occurred on a receive." So please can anybody help me where exactly the problem is.Is that the problem with the code or serevr settings.
Thanks in advance
Here is my code
private static void Upload()
{
string[] strar = new string[] { sourcepath + ".zip", sourcepath + ".txt" };
foreach (string str in strar)
{
FileInfo fileInf = new FileInfo(str);
string uri = "ftp://" + ftpServerIP + "/" + fileInf.Name;
FtpWebRequest reqFTP;
// Create FtpWebRequest object from the Uri provided
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" + ftpServerIP + "/" + fileInf.Name));
//Set the proxy to null to get around the "the requested ftp command is not supported when using http proxy" error
reqFTP.Proxy = null;
reqFTP.Timeout = 2000000000;
// Provide the WebPermission Credintials
reqFTP.Credentials = new NetworkCredential(ftpUserID, ftpPassword);
// By default KeepAlive is true, where the control connection is not closed
// after a command is executed.
reqFTP.KeepAlive = false;
// Specify the command to be executed.
reqFTP.Method = WebRequestMethods.Ftp.UploadFile;
// Specify the data transfer type.
reqFTP.UseBinary = true;
// Notify the server about the size of the uploaded file
reqFTP.ContentLength = fileInf.Length;
// The buffer size is set to 2kb
int buffLength = 2048;
byte[] buff = new byte[buffLength];
int contentLen;
// Opens a file stream (System.IO.FileStream) to read the file to be uploaded
FileStream fs = fileInf.OpenRead();
try
{
// Stream to which the file to be upload is written
Stream strm = reqFTP.GetRequestStream();
//mydelegate delinstance = new mydelegate(Writedata);
//int result;
//Stream strm = reqFTP.BeginGetRequestStream(null, null);
//Stream strm = reqFTP.BeginGetRequestStream(delinstance,result);
// Read from the file stream 2kb at a time
contentLen = fs.Read(buff, 0, buffLength);
//progressBar1.Maximum = contentLen;
// Till Stream content ends
//progressBar1.Step=10;
while (contentLen != 0)
{
// Write Content from the file stream to the FTP Upload Stream
strm.Write(buff, 0, contentLen);
contentLen = fs.Read(buff, 0, buffLength);
//if (progressBar1.Value < progressBar1.Maximum)
// progressBar1.PerformStep();
}
//progressBar1.Value = 0;
// Close the file stream and the Request Stream
strm.Close();
fs.Close();
Console.WriteLine("Uploading completed for file " + str);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message, " Upload Error");
Console.ReadLine();
}
Console.ReadLine();
}
}
|
|
|
|
|
I HAVE ONE TEXTBOX TO GET MOBILE NUMBER AS INPUT....
IF ANY TEXT ENTER IN THE TEXTBOX MEANS IT WILL SHOW...
"ENTER ONLY DIGITS"....
SEND ME SUGESSTION...
USING WINDOWS APPLICATION...
|
|
|
|
|
1. Don't use caps lock while posting a question.
2. Don't request something, just as nicely
3. Look at KeyPressed event of textbox or use Google to find more help.
|
|
|
|
|
Use masked textbox.
C isn't that hard: void (*(*f[])())() defines f as an array of unspecified size, of pointers to functions that return pointers to functions that return void
"Always program as if the person who will be maintaining your program is a violent psychopath that knows where you live." - Martin Golding
|
|
|
|
|
I am creating a folder watcher application.
If a new powerpoint file gets added in the folder it should get started automatically.
So if I put .pps file into the folder then and I say
System.Diagnostics.Process.Start(fullPath);
it works fine.
This is not the case with .ppt files
Only the powerpoint application gets started not the slideshow.I want the slideshow to be started.
I have done some R & D and found that Microsoft.Office.Interop.PowerPoint will help and done something like this
Microsoft.Office.Interop.PowerPoint.Application ppApp = new Microsoft.Office.Interop.PowerPoint.Application();<br />
ppApp.Visible = MsoTriState.msoTrue;<br />
Microsoft.Office.Interop.PowerPoint.Presentations oPresSet = ppApp.Presentations;<br />
Microsoft.Office.Interop.PowerPoint._Presentation oPres = oPresSet.Open(e.FullPath,<br />
MsoTriState.msoFalse, MsoTriState.msoFalse,<br />
MsoTriState.msoTrue);<br />
But this is also doing the application open not the slideshow, does anybody have any idea?
Also I want rest all powerpoint presentations gets closed and only currently added powerpoint application gets started as slideshow.
Thanks in advance,
|
|
|
|
|
I'm not sure how possible that is. If double clicking doesn't open PPT, then PPT is not responding to being passed the application as a command parameter.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Thanks for quick reply,
I am not very much clear with your answer.
Actually I want the ppt application start automatically when it gets placed in the folder under watch.
|
|
|
|
|
salon wrote: I want the ppt application start automatically when it gets placed in the folder under watch.
Assuming you have a FolderWatch watching on the folder, when a file is placed in the folder, run Process.Start("YourPPTFileName") . It will open the PPT file in associated application.
|
|
|
|
|
yes. You are correct. This code segment will start the ppt application, but i want to start the slideshow.... not the applciation...
If u use the same code segment for .pps files, it will start the slideshow directly....
The same thing I want with .ppt files.....
I know there is a way with
Microsoft.Office.Interop.PowerPoint.Application ppApp = new Microsoft.Office.Interop.PowerPoint.Application();
And inside this there is an event named "SlideShowBegin" but I am not getting how to use this event to start the slideshow....
|
|
|
|
|
|
Thanks friends for your valuable replies. The main problem is solved of launching the slideshow of .ppt files.. with the help of this code
<br />
Microsoft.Office.Interop.PowerPoint.Application ppApp = new Microsoft.Office.Interop.PowerPoint.Application();<br />
ppApp.Visible = MsoTriState.msoTrue;<br />
Presentations ppPresens = ppApp.Presentations;<br />
Presentation objPres = ppPresens.Open(e.FullPath, MsoTriState.msoFalse, MsoTriState.msoTrue, MsoTriState.msoTrue);<br />
Slides objSlides = objPres.Slides;<br />
Microsoft.Office.Interop.PowerPoint.SlideShowWindows objSSWs;<br />
Microsoft.Office.Interop.PowerPoint.SlideShowSettings objSSS;<br />
<br />
objSSS = objPres.SlideShowSettings;<br />
<br />
objSSS.Run();<br />
objSSWs = ppApp.SlideShowWindows;<br />
while (objSSWs.Count >= 1) System.Threading.Thread.Sleep(100);<br />
<br />
objPres.Close();<br />
ppApp.Quit();<br />
Now I want to close all the running powerpoint files and only want to run the current one only...
Does any body have any idea?
|
|
|
|