|
Dave is exactly right: "show up Access" in a DataGridView will not change the resolution of a form: nothing can change the resolution of a form independently of the system on which it is running!
What you probably mean is that something changes size; maybe your form gets bigger or smaller, we don't know. But we have no idea what you did to do that: we can't see your screen, access your HDD, or read your mind; we only get exactly what you type to work with.
Have a read here: Why Won't You Answer My Question?[^] and try asking again - we'd like to help, but you have to help us to help you!
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I'm googled out and I haven't yet found out how to get the subnet mask for any connected network in the .NET framework.
Does anyone know? Or can point me in the right direction?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Hi Richard,
I haven't done this, however maybe this[^] may help.
I found this link and others googling for C# internet submask ; I always start my search with C# when looking for an API.
I also looked into WMI , the only class I found holding submask info is Win32_IP4RouteTable , but it looks all but simple to use that.
|
|
|
|
|
Thank you Luc!
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
i want from my application to import data from text file or csv file or excle file by clik one button how do this by c# code
|
|
|
|
|
|
Member 13588700 wrote: i want from my application to import data from text file or csv file or excle file by clik one button how do this by c# code
Well, it always, and it still is a very good idea to first search MSDN for the problem before posting a question to the Forum.
|
|
|
|
|
For CSV, I use this: A Fast CSV Reader[^] which works really well.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Hello, I have good resources and keyword here:
Articles how to start
Let me know what is destination of the data? Is it Ms SQL Server, or what?
As far as I know You can use SSIS to import data from excel, csv, etc.
And I have some experience create it from scratch and the system goes well so far.
Regards
Toha
|
|
|
|
|
In my Winform App, I'm sending an email with an attachment and I get the above error. Kind of stumped on this and I know it' attachment related.
So I get this on the first run after starting the program.
I generate a PDF, write it to AppData folder, then program the Smtp Client, run the code below.
I tried ..
Comment out the attachment and it works fine.
Tried not using "using"
Tried fileStream.Position = 0
Tried fileStream.FlushAsync = 0
Searched for a quick fix but never really found anything.
I'm using CeTe Dynamic PDF to generate the PDF with Document.Draw
if (message.FilePath != null )
{
using (var fileStream = File.OpenRead(message.FilePath))
{
var attach = new Attachment(fileStream, message.FilePath);
mailMessage.Attachments.Add(attach);
await fileStream.FlushAsync();
}
}
using (var smtpClient = SendEngineAsync.Create_SMTPClient(smtpC))
{
var result = await SendEngineAsync.SendEmailAsync(smtpClient, mailMessage, 5);
SendEngineAsync.ProcessSendResult(resend, result);
}
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
Well, since the attachment will always be there, I changed the code to this.
It works, but I need to test it multiple sends to see if it happens again down the road.
using (var fileStream = File.OpenRead(message.FilePath))
{
var document = new Attachment(fileStream, message.FilePath);
mailMessage.Attachments.Add(document);
using (var smtpClient = SendEngineAsync.Create_SMTPClient(smtpC))
{
var result = await SendEngineAsync.SendEmailAsync(smtpClient, mailMessage, 5);
SendEngineAsync.ProcessSendResult(resend, result);
}
}
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
|
Oh that's works as well. I bet that's how I did it originally before I wandered off path.
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
I thought this would be easy.
I have a form with a user control I made which is an invoice creator that is self contained.
I ran out of space on the user control for a Save button, so I kept the Save button on the master form.
I want to click on the Form Save button and pass the click to the user control to do it's thing.
I searched the web, but all the examples are the other direction, user control to form.
I thought this would be correct using a delegate on the user control, but most examples were for passing text
public partial class CreateQuotationForm : UserControl
{
private readonly string _quotationId = ObjectId.GenerateNewId().ToString();
private ImageList _imageListSmall;
private ImageList _imageListLarge;
private List<QUOTATION_ITEMS> _quotationItems;
public delegate void SaveClickEventHandler(object sender, EventArgs e);
private SaveClickEventHandler saveClick;
public event SaveClickEventHandler SaveClick
{
add { saveClick += value; }
remove { saveClick -= value; }
}
Then on the form, I'm clueless
private void OK_Button_Click(object sender, EventArgs e)
{
}
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
You're over-complicating it.
Your Save button should just call a method the UserControl exposes to do that save. There's no need at all to "pass the click on".
|
|
|
|
|
I think you just worded it better than I did. But I get it!
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
Events are there so that the world outside (and inside) the control can take action when something happens to that control: what you are trying to do is the reverse - make a control take action when something happens in the outside world. For that, the control could add a handler to an outside world event (bad idea, and complicated) or it could expose a method that the outside world can call in order to take an action.
The second is the route you want to go: think about an Image class instance - it has a Save method which stores the Image data to a disk file or stream which is called by your code:
private void butSave_Click(object sender, EventArgs ew)
{
myImage.Save(@"D:\Temp\MyPicture.jpg", ImageFormat.Jpeg);
}
That's what your code is trying to do!
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I'll go the latter route then. Maybe I should put the save button on the user control. But I'll give the latter a try for learning purposes.
Thanks for clear thought on what I'm trying to do.
[edit]
So I put a click event on the user control, made it public and called it from the form.
It works, but not sure if it proper coding. I wonder if I can make the form wait for the save and load the new data.
If it ain't broke don't fix it
Discover my world at jkirkerx.com
modified 8-Jan-19 12:41pm.
|
|
|
|
|
You're welcome!
Save button on user control is a good idea, probably - but it may make more sense to have the containing form handle that. That way the UserControl could be reused to create and display existing invoiced (which you aren't supposed to modify once created, remember). It could be that by adding Save to the Control that you "tie" the usercontrol to one storage format. A more OOPs solution would be to have an Invoice class which knows how to save and load itself from a stream (or similar) and then issue the Save command to that. Kinda "separating the layers" between the Presentation (UserControl) and Data and / or Business Logic layers if you see what I mean.
I don't know how the rest of your app works though!
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Your right on the money with that thought.
I made a quotation model for MongoDB, and placed a public property of the model on the user control.
On a new or edit, I just feed the model into the user control, and set the rest of the data such as
Expiration date, Quotation Items, Notes and then click save on the parent form and my model is complete.
Then I can do a CRUD write of the quotation to MongoDb as one complete document with the quoted items inside.
I feel pretty good about the design and I think it's solid.
[edit]
I said invoice but it's really a quotation creator.
The program scrape a distributor website of 5000+ products using Agility Pack and allows you to make Excel sheets in the morning for the latest pricing and to look for deals. but to add value, I wanted to be able to create quotes off the data with a few simple clicks and email them as a PDF. Going to post it on GitHub soon to show off my work.
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
Currently I'm loading plugins like this
private void LoadPlugins()
{
var pluginPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);
var directoryCatalog = new DirectoryCatalog(pluginPath);
var container = new CompositionContainer(directoryCatalog);
var plugins = container.GetExportedValues<ISomeInterface>();
}
As the comment says, the interface is required to be compiled into this app.
Is there a way to load MEF plugins without the host app knowing about the interface?
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
Caveat - I have not used MEF or plug ins.
Uhm that does not seem to make sense, the host application needs to code against the functionality of the plug in, hence the required interface. I am scratching my head trying to figure out a use case for not having an interface for the plug in.
I will be interested in other responses
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
I don't think you can get rid of the interface. How is the host app supposed to know how to call the methods in the plug-in, and what they do, if the plug-in doesn't implement some kind of interface?
|
|
|
|
|
I can see where you are going with this but you have the problem inverted. It sounds like you have a contract that you have created in a plugin assembly and you are trying to use MEF to load that assembly, which has already been linked with the application. Rather than doing this, you would normally have the interface defined in an assembly that just contains contracts. Both the plugins and the application host will be linked with that assembly but they will not share any code and the application host does not have to know anything about the plugins other than that they share an interface. That way you keep them both from knowing about each other, as they rely on the intermediary.
This space for rent
|
|
|
|
|
When I put a control( for example a textbox) into the application form's environment from the Toolbox Visual 2010 component inside the code environment but it does not recognize that control inside the code environment But yesterday it recognized that. :wtf:
|
|
|
|