|
So; you're saying you have properties called "Hello" and "World" somewhere?
Did you implement the INotifyPropertyChanged interface?
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
I did implement INotifyPropertyChanged but i finally solved my problem
i remove this.DataContext = this; from the user control
and added relative reference
to label content:
Content="{Binding Label, RelativeSource={RelativeSource AncestorType=UserControl}}"
and textbox text:
Text="{Binding Text,RelativeSource={RelativeSource AncestorType=UserControl}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
|
|
|
|
Hi there. I have following scenario
- one machine with a service installed (machine 1)
- one remote machine with public ip (machine 2)
- one machine with web application (machine 3)
All these machines could be in the same premises or in different. Since all of these machines and their respective software could be installed in any order, I don't know how to get machine 2's IP. Because my service on machine 1 will use this IP to upload data to it. And, of course, web application on machine 3 will display this data.
Any idea what API/library could I use on machine 1 to recieve machine 2's IP? Thanks for anything you share.
|
|
|
|
|
The user will have to enter it; there's no way that any api or library could "guess" which computer is meant with "machine 2".
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Why don't you have machine 2 login to machine 1 and upload (i.e. FTP); instead of 1 calling 2, etc.
A scheduler on #2 and an event / file handler on #1 should suffice; based on your description.
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
//Report Load page code using dataset
private void RPT_SupplierPer_Load(object sender, EventArgs e)
{
crystalReportViewer1.ReportSource = null;
DataTable dt = new DataTable();
SqlConnection con = new SqlConnection(cs.cstring());
con.Open();
SqlCommand cmd = new SqlCommand("RPT_Sup_All", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@id",ID);
SqlDataAdapter da = new SqlDataAdapter();
DataSet ds = new System.Data.DataSet();
//SupplierPer sp = new SupplierPer();
//da.Fill(ds);
// ds.Tables[0].TableName="RPT_Sup_All";
SupplierPer sp = new SupplierPer();
sp.Database.Tables[0].SetDataSource(ds.Tables[0]);
sp.SetDataSource(ds);
crystalReportViewer1.ReportSource = sp;
crystalReportViewer1.Refresh();
}
//print button code
private void btnPrint_Click(object sender, EventArgs e)
{
int id = Convert.ToInt16(txt_id.Text);
RPT_SupplierPer pt = new RPT_SupplierPer(id);
pt.Show();
}
|
|
|
|
|
You have already posted this in Question section.
modified 20-Sep-20 21:01pm.
|
|
|
|
|
My project would not run probably since i have 2 js file are crashing, but these 2 js files are important in my project and cant throw it. how can i solve this by other ways. TQ
|
|
|
|
|
And you want to use C# to solve the problem?
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
Downvote countered.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Member 13056303 wrote: how can i solve this by other ways. By debugging your application and working out what is causing these files to "crash" and then fixing those defects.
This space for rent
|
|
|
|
|
I have C# code, visual studio 2015 for desktop data entry application. I have 9 columns in datagridview. I need only 5 columns for pdf. One of 5 columns will blank. Please sample code or example.
|
|
|
|
|
Member 13023028 wrote: I have C# code, ... Please sample code or example. Which one should we follow? Typically, such complex data structures are never shared on an online "sample" code, and this defines your business logic and should be developed by you.
You can start something off, and then let us help you, but we do not provide free codes. For a beginner's code or article, please search on the top right corner.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
Collapse / hide the unwanted columns.
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
I already have very large amount of code . Now I want to integrate one more functionality for this code for which i have to execute some code before and after every function call .How can i do this effectively.
|
|
|
|
|
This is a complicated topic, and one you really should have designed for before you reached this point. Normally, you would apply something called Aspect Oriented Programming (AOP) to allow you to automatically add code to your application at specified points. This gives you fine grained control of what you want to do. As you haven't designed your application for this, you're probably going to have to fall back to a technique called IL weaving - this means that you are going to weave in IL code to your application (it's what most AOP systems do, but they give you control over the process - you're going to end up having to manually do this yourself).
You will probably find this[^] article to be some help in getting started.
This space for rent
|
|
|
|
|
|
In addition to the CP article that Pete cited, also see: [^], [^].
«When I consider my brief span of life, swallowed up in an eternity before and after, the little space I fill, and even can see, engulfed in the infinite immensity of spaces of which I am ignorant, and which know me not, I am frightened, and am astonished at being here rather than there; for there is no reason why here rather than there, now rather than then.» Blaise Pascal
|
|
|
|
|
Thank you very much BillWoodruff .Can you please tell em how to pass our own custom attributes .
|
|
|
|
|
Question: what is the scale/scope of the code base you wish to monitor/log ? Multi-threading involved ? Team project with multiple code repositories ?
Also see this recent article: [^].yeswanthkumar wrote: Can you please tell em how to pass our own custom attributes While I am a registered owner of PostSharp, I do not have the expertise to comment on any other method/tool, and I have never tried to explore creating custom attributes in PostSharp: however their documentation/support are very good, and I expect if the need arose, it could be done: [^].
imho, the task of IL-weaving/AOP is an extremely technically deep subject, and experimenting with "rolling your own" potentially risky in terms of technical "cost."
Have you looked at Spring.NET: [^] ?
cheers, Bill
«When I consider my brief span of life, swallowed up in an eternity before and after, the little space I fill, and even can see, engulfed in the infinite immensity of spaces of which I am ignorant, and which know me not, I am frightened, and am astonished at being here rather than there; for there is no reason why here rather than there, now rather than then.» Blaise Pascal
|
|
|
|
|
OK, here's a real mind-twister. I can't figure out how to declare the parameter of a function as deriving from a generic class.
Here's the code:
public class BusinessObjectBase
{
}
public class BusinessObjectList<T> : List<T> where T : BusinessObjectBase
{}
public class BusinessObjectDataSet : DataSet
{
protected BusinessObjectList<BusinessObjectBase>[] _BusinessObjectListArray = null;
public virtual void AddBusinessObjectList(BusinessObjectList<BusinessObjectBase> List)
{
}
}
I want to specify the variable as type BusinessObjectList<T> where T derives from BusinessObjectBase.
The code above compiles fine, but when I go to use the classes, that's the problem:
private class MyBusinessObject : BusinessObjectBase
{
public MyBusinessObject()
{
}
}
private class MyBusinessObjectList<MyBusinessObject> : BusinessObjectList<T> where T : BusinessObjectBase
{
}
BusinessObjectDataSet Set = new BusinessObjectDataSet();
MyBusinessObject Bo = new MyBusinessObject();
MyBusinessObjectList<MyBusinessObject> BoList = new MyBusinessObjectList<MyBusinessObject>();
Set.AddBusinessObjectList(BoList);
What am I doing wrong?
Thank you for taking the time to grok this.
EDIT: Fixed an omission in the code. Revised the question that I'm asking.
The difficult we do right away...
...the impossible takes slightly longer.
modified 29-May-17 16:14pm.
|
|
|
|
|
The problem is that the two lists aren't covariant.
What that basically means is that if you construct collections:
class Animal {...}
class Ape : Animal {...}
class Feline : Animal {...}
List<Ape> apes = new List<Ape>();
List<Feline> cats = new List<Feline>();
List<Animal> animals = new List<Animal>(); Then because an Ape is an Animal, you can add a new species to either collection:
Ape newSpecies = new Ape("Pans Sapiens");
apes.Add(newSpecies);
animals.Add(newSpecies);
But if you try to add it to the Felines:
cats.Add(newSpecies);
You will get a compilation error:
Argument 1: cannot convert from 'GeneralTesting.frmMain.Ape' to 'GeneralTesting.frmMain.Feline'
And that is what you would expect.
But ... if you could do what you want, you could do this:
Ape newSpecies = new Ape("Pans Sapiens");
animals = cats;
animals.Add(newSpecies);
And you would have an Ape in your Feline collection - which means your application will crash later on when you try to use it.
What you are passing to the AddBusinessObjectList is not a BusinessObjectList<BusinessObjectBase> - it's a derived list of a derived class.
I'm not sure exactly what you can do about this - it may be possible to construct a cast operator, but I'm not sure if that would work without some serious head scratching!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
OriginalGriff wrote: I'm not sure exactly what you can do about this
Yes, thank you for taking the time to answer. If the suggestion from Pete doesn't work I think I may have to redesign this.
I'm very sorry that generics are invariant, as I now see it says in the documentation.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
The issue is down to the harder constraint you have in place in AddBusinessObjectList. Try changing it to this instead:
public virtual void AddBusinessObjectList<T>(BusinessObjectList<T> List) where T : BusinessObjectBase Oh, and change your definition of MyBusinessObjectList to this:
private class MyBusinessObjectList<T> : BusinessObjectList<T> where T : BusinessObjectBase
This space for rent
|
|
|
|
|
Thank you for taking the time to answer. If your suggestion doesn't work, I'll try redesigning everything to make it simpler.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|