|
I don't know a blessed thing about Prism, but it looks like the error that I get when trying to import an object that does not construct properly.
Are you trying to import a Prism region that might have a configuration issue, or might be influenced by an environmental factor?
"Never attribute to malice that which can be explained by stupidity."
- Hanlon's Razor
|
|
|
|
|
Hello,
Once I try to show up Access DB (.Accdb) in DataGridView, resolution of the form changes.
what is solution for this issue ? Thanks.
modified 13-Feb-19 21:02pm.
|
|
|
|
|
This isn't a good question. Just using an Access database in your app isn't going to "change the resolution" of anything.
We have no idea how your code is written, what the exact code at the point of failure looks like, or anything else about your code so it's impossible to tell you anything useful.
You're going to have to describe exactly what happens. Does the size of the entire form change? Is it just a control on the form, like the DataGridView? You're also going to have to use the debugger narrow down the exact method in which this "change" happens. Is it when the data is retrieved from the database? Is it when the DGV is bound to the new data? When?
|
|
|
|
|
Thanks for advice. Codes are below :
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace datagrid
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
this.kolonTableAdapter.Fill(this.stokDataSet.kolon);
}
}
}
I also see .accdb and .dataset.xsd file are added to project. Yes entire form size changes once I start the app. No error returns from debugger. please let me know if more to clarify.
modified 13-Feb-19 21:02pm.
|
|
|
|
|
OK, so you're using the designers to do database work. That's not a good idea, despite what Microsoft says. The designers hide a lot of the code and workings, basically teaching you nothing about how to do this stuff.
What I can say is none of that code is going to change the size of either controls or forms, so the problem is somewhere else. What properties did you change on the Form and the DGV. The properties that have been changed from default will be shown in bold text in the Properties window when you click on the Form or the DGV in the designer.
|
|
|
|
|
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
|
|
|
|