|
thank but i'll did the convert and someting go worng at the vb.net
and i think the prublem is there
|
|
|
|
|
Here's a quick hint that will make your boss think you are a coding god.
First of all, download Lutz Roeder's excellent Reflector[^].
Then, open up the original DLL file that you want to redo.
Change the combo box from C# to Visual Basic and then select the methods you are interested in.
Select Disassembler and, hey presto, you have a VB.NET version of the C# code.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Yes, Yes!
There should be a "Lutz Roeder monument"!
|
|
|
|
|
(via Instant VB):
If Not OnSchedulerEventEvent Is Nothing Then
note the 'Event' tagged onto the end. This accesses the hidden <event>Event variable in VB. But as an earlier poster mentioned, you rarely should need to do this check in VB since "RaiseEvent" does it for you.
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C# to C++ converter, VB to C++ converter
Instant Python: C# to Python converter, VB to Python converter
|
|
|
|
|
Hello
I want to send a crypted email with a certificate and a word attachment file.
So I have created a MailMessage and I have crypted my Word Document with my Certificate.
Then I have created and alternate View with the crypted attachment.
When I receive the mail, my mail is well cryped and the attachment is in the mail (icons are displayed in outlook)
The problem is that the attachment is opened in the body of the mail just like Text (So i can see all the word specific data).
I cannot see the word as an attachment and to save it.
Any Help is welcomed
<br />
MailMessage eMail = new MailMessage();<br />
eMail.From = new MailAddress("MyMail@MyCompany.com");<br />
eMail.To.Add(new MailAddress("MyMail@MyCompany.com"));<br />
eMail.Subject = "Test";<br />
SmtpClient Smtp = new SmtpClient("MyCompany.com")<br />
<br />
#region crypt<br />
<br />
X509Certificate2 myCertificat = new X509Certificate2(@".\MyCert.cer", "xxxx");<br />
System.IO.Stream myFile = null;<br />
myFile = new System.IO.FileStream(@".\Test.doc", System.IO.FileMode.Open,System.IO.FileAccess.Read);<br />
byte[] data = new byte[myFile.Length];<br />
myFile.Read(data, 0, (int)myFile.Length);<br />
<br />
ContentInfo contentInfoCrypt = new ContentInfo(data);<br />
EnvelopedCms envelopedCms = new EnvelopedCms(contentInfoCrypt);<br />
CmsRecipient recip1 = new CmsRecipient(myCertificat);<br />
envelopedCms.Encrypt(recip1);<br />
envelopedCms.Certificates.Add(myCertificat);<br />
byte[] encryptbytes = envelopedCms.Encode();<br />
#endregion<br />
<br />
MemoryStream mss = new MemoryStream(encryptbytes);<br />
<br />
AlternateView av = new AlternateView(mss, "application/x-pkcs7-mime; smime-type=enveloped-data; name=smime.p7m;");<br />
eMail.AlternateViews.Add(av);<br />
Smtp.Send(eMail);<br />
|
|
|
|
|
Hi All,
Is there any possiblity of getting the file name that is being closed currently.
For example, if a text file is opened by name "abc.txt". When I'm closing this file, a message must be prompted that "File abc.txt is closed". I need to do this in C#.
Any code sample will do..
Thanks in advance
Parimala
|
|
|
|
|
Well, the normal way to do this is to store the filename in a member variable and then refer to this.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
I'm not able to follow what the member variable means?
Could you be more specific?
Parimala
|
|
|
|
|
string memberVariable = filename;
|
|
|
|
|
Even if i get the filename, what event or action will indicate that the opened file is closed?
Parimala
|
|
|
|
|
You could create your own class which handles all the file access, give it the member variable as suggested and create an event/delegate which you can fire when you close any FileStream. Then you can create an event handler in the main app to show your message.
Here's an article to help you create your own events if you've not done it before: http://www.codeproject.com/csharp/eventdelegates.asp[^]
|
|
|
|
|
How the text file is opened.. whether r u open it programmatically or juz like that u opened.
if you opend the file programmatically.. it is easy to notify that file is opened/closed otherwise c for any other possibility like FileWatcher class..
|
|
|
|
|
The file is opened programmatically. Another application has to monitor whether the file is closed or not.
Parimala
|
|
|
|
|
<blockquote class="FQ"><div class="FQA">ParimalaRadjaram wrote:</div>For example, if a text file is opened by name "abc.txt". When I'm closing this file, a message must be prompted that "File abc.txt is closed". I need to do this in C#.</blockquote>
I have written a console application for you:
<code>
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
namespace OnCloseEventExample
{
class SpecFileStream : System.IO.FileStream
{
private string _fileName;
public string FileName
{
get { return _fileName; }
set { _fileName = value; }
}
//lazy to create a new delegate. We are using System.EventHandler
public event EventHandler FileClose;
public SpecFileStream(string filePath, FileMode mode)
: base(filePath, mode)
{
_fileName = Path.GetFileName(filePath);
}
public override void Close()
{
FileClose(this, new EventArgs());
base.Close();
}
}
class Program
{
static void Main(string[] args)
{
string filePath = "";
if(args.Length < 1)
{
filePath = @"C:\test.txt";
}
else
{
filePath = args[0];
}
SpecFileStream sfs = new SpecFileStream(
filePath,
System.IO.FileMode.Create
);
sfs.FileClose += new EventHandler(sfs_FileClose);
byte[] data = Encoding.ASCII.GetBytes("writes to file this");
sfs.Write(data, 0, data.Length);
sfs.Close();
}
static void sfs_FileClose(object sender, EventArgs e)
{
SpecFileStream sfs = sender as SpecFileStream;
if (sfs != null)
{
Console.WriteLine("File " + sfs.FileName + " is being closed!");
}
else
{
throw new Exception("Invalid sender object class!");
}
}
}
}
</code>
If any comments are needed, feel free to ask.
|
|
|
|
|
I'll try this and let u know. Thanks a lot.
Parimala
|
|
|
|
|
When i'm compiling the code, i'm getting the following error. Could just tell me why this happens?
'System.IO.FileStream.FileStream()' is inaccessible due to its protection level
Parimala
|
|
|
|
|
yes...!
it is posible but you have to get location where is your file is located. then using FSO object then you can get all files name of the directory.
cheer
Pavan Pareta
|
|
|
|
|
Pavan_pareta wrote: it is posible but you have to get location where is your file is located. then using FSO object then you can get all files name of the directory
Why the FileSystemObject? There are better .NET ways of doing this.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi all,
I need to create a custom control DataGrid that should contain ListBox
control as one of the column that allow to select a value from multiple values.
This is possible in DataGridView.
But is it possible in DataGrid ?
Thanks in Advance
Karthik M
|
|
|
|
|
YES IT IS POSSIBLE...
I HAVE DONE IN PAST... I DONT HAVE THE CODE FOR THAT RIGHT NOW.. BU TU CAN GO CHECK OUT IN CsharpCORNER.COM.
basically the idea is... fill ur datagrid... then add new column to it, and then add a combo to it.. finally fill ur combos according to the condition..... it is simple but lengthy task...
hpoe u can find ur way.....
|
|
|
|
|
Thanks for your reply.
But i need to add multiselect listbox in the datagrid.
Is there any way to do this ?
Karthik M
|
|
|
|
|
You can, normally, create column types with cells that host controls of your choosing, whatever they might be. You have to define classes that derive from DataGridViewColumn and DataGridViewCell . Here[^] is shown an example for the case of a DateTimePicker control. Adapt the code to a ListBox.
Oh, yes there is some work to do for it, but I guess you enjoy it!
SkyWalker
|
|
|
|
|
Thanks Mircea,
I guess i have clearly mentioned in my query that i can include the ListBox
in DataGridView.
But i cant include the ListBox in DataGrid.
Is it possible ?
-- modified at 23:29 Tuesday 30th January, 2007
Karthik M
|
|
|
|
|
Hey Karthik
the way i told u u can implement it,
ok let me remind me my self ur question...
u want add multiselect listbox... in datagrid...
yes it is possible. and in the same fashion i told u in my previous post....
dont mid let me ask u a question.... do know the diff.. between Combobox and list box, in terms of web... and windows....
but what u want to achive with that... i think u r trying to do something very complicated in ur page.....
|
|
|
|
|
I´m trying to read a xml file into typed dataset, but I really can´t get it done. Here´s a simple code of what I´m trying to do:
typedDS.ReadXml("d:\\Test.xml");
I don´t get any exception, but there are no records in the dataset. Can anyone help me with this?
cellardoor
|
|
|
|