|
So do. What is stopping you?
I do it all the time: A solution of projects which produce DLL Assemblies (either with a single test EXE project or individual test EXE projects as necessary).
Other projects producing EXEs reference either the Release build Assembly, or the project that generated it (depending on whether I need to step into the DLL assembly for debugging purposes or not).
Change the DLL, rebuild it, overwrite / reregister it, and the existing EXE projects use the new version without needing any recompilation.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Sounds like you need a DLL, or a COM library. In both cases you can manage future enhancements with new versions without affecting existing clients. Google, or the CodeProject Articles section[^] should have some whitepapers and samples.
|
|
|
|
|
I have a base class that sets property values:
<pre>public void SetProperty<T>(string propertyName, ref T propertyField, T value)
{
if (!Object.Equals(value, propertyField))
{
if (OnPropertyChanging(propertyName, propertyField, value))
{
IsDirty = true;
T oldValue = propertyField;
propertyField = value;
RaisePropertyChanged(propertyName);
OnPropertyChanged(propertyName, oldValue, propertyField);
}
}
}
I then call it like this:
<pre>private string _CompanyName;
public string CompanyName
{
get { return _CompanyName; }
set
{
if (_CompanyName != value)
{
SetProperty<string>("CompanyName", ref _CompanyName, value);
}
}
}
Yet for a nullable property I get a compilation error.
private decimal? _GLRate;
public decimal? GLRate
{
get { return _GLRate; }
set
{
SetProperty<decimal>("GLRate", ref _GLRate, value);
}
}
Cannot convert from ref decimal? to ref decimal
I'm guessing it doesn't work with generics??
How can I make this work?
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
"decimal" is not the same type as "decimal?" even though they have a lot of characters in common ("?" is what the call syntactic sugar, Visual Studio converts decimal? into a type that looks nothing like "decimal")
So update the type in the angle brackets to reflect the actual type
SetProperty<decimal?>("GLRate", ref _GLRate, value);
However you can actually do without the brackets altogether, .net can work the type out from the params you supply
SetProperty("GLRate", ref _GLRate, value);
|
|
|
|
|
Removed the <types>.. Works great! Thank you!
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
On a side note, if you use "nameof", you can get rid of your string "values" in this case and use the compiler for insuring valid names.
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
Hi,
I have an existing application in which i have to add/update around 5000 rows * 50 Columns at a time within One Minute.
On each row update i have to do following two things :
> update two columns back color upon condition.
> Play Sound (like new row added, row updated etc) upon condition.
I have tested ComponentOne FlexGrid and DevExpress Grids so far. Both are good but when i send 100,000 orders, they keep jerking/freezing for few milliseconds.
Is there any best gridview exist inspite of that two grids ??
Thanks in advance.
|
|
|
|
|
There isn't a grid in existence that will keep up with that kind of demand.
The problem isn't the grid. It's how you're using it.
The grid can only show probably 100 rows, so why are you updating grid rows that can't be shown? You don't update the data in the grid at all. You update the data source the grid is bound to.
|
|
|
|
|
Good evening, I followed the steps that you made on how t make a Remote Desktop Using C#.Net. But I can't connect to the computer that I wanted to control. Also, will I use the username and password of the current user account that is logged in to the username and password in your tutorial?
|
|
|
|
|
Don't post this here - if you got the code from an article, then there is a "Add a Comment or Question" button at the bottom of that article, which causes an email to be sent to the author. They are then alerted that you wish to speak to them.
Posting this here relies on them "dropping by" and realising it is for them.
And there are 13,347,998 members here, any one of which might have written the article you are talking about! Add to that the many, many thousands of article on the site, and we have no idea what article you are talking about either...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Please help me on how can I put a triangle and square shape in the center of my image. I will use plain white image so that the triangle and square shape will be visible. The first step is when I click the browse image then I will sample browse the plain white image then it will display to the picturebox1. Then there is an two button which is triange and square. If I click the triange button the plain white image will display to the picturebox2 with triangle shape in the center. Likewise when I click the square button. Please help me for my project.
this is my browse button code
private void button1_Click(object sender, EventArgs e)
{
OpenFileDialog opf = new OpenFileDialog();
opf.Filter = "Choose Image(*.jpg;*.png;*.gif)|*.jpg;*.png;*.gif";
if (opf.ShowDialog() == DialogResult.OK)
{
pictureBox1.Image = Image.FromFile(opf.FileName);
}
Bitmap bmp = new Bitmap(opf.FileName);
pictureBox1.Image = Image.FromFile(opf.FileName);
}
I have no code for triangle button and square button kindly help me on how to do it. Please
|
|
|
|
|
For starters, look at your code:
if (opf.ShowDialog() == DialogResult.OK)
{
pictureBox1.Image = Image.FromFile(opf.FileName);
}
Bitmap bmp = new Bitmap(opf.FileName);
pictureBox1.Image = Image.FromFile(opf.FileName);
Why are you doing that? Any of that, really?
If the OK button is pressed you load an image from a file. Then you load it again, and throw that away. Then you load it again and stuff it over the top of the first one you loaded.
If the Cancel button is pressed, you load the image (which will probably fail because there is no filename in the dialog) throw that away, and load it again (failing again) and muck up your picture box anyway...
Throw away the last two lines of that code. Then if and only if the user pressed OK
1) Load the image from the file
2) Copy the image into a new image and Dispose the original
3) Then set the copy as the PictureBox.Image
The reason for that is that when you create an image from a file, it locks the file until the Image is Disposed - so you need to work with a copy 99% of the time or your code fails in interesting ways later!
Then handle the PictureBox.Paint event. Inside that, you can use the supplied Graphics Context to draw over the Image using:
Graphics.DrawLine Method (Pen, Point, Point) (System.Drawing)[^] Call it three times fro your triangle.
Graphics.DrawRectangle Method (Pen, Int32, Int32, Int32, Int32) (System.Drawing)[^] Call it once to draw your rectangle.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Thanks for your reply. My point is I want to display to the picturebox2 of an square shape at the center of the plain white image when I click the button Square.
|
|
|
|
|
Then don't load the image from a file: create a new Bitmap of the right dimensions.
Then use the Graphics.FromImage method in a using block to get the context to draw on.
Use Graphics.FillRectangle to draw it as a solid white background.
Then use Graphics.DrawRectangle to draw your square.
Finally, set the Bitmap as the Image for the PictureBox.
Use a very similar process to draw your triangle with Graphics.DrawLine
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I would personally not even try to load an image. If the only reason is that you need a white background, use a panel and define the background as white. That means one less point of potential failure.
To draw on that panel you can create a "Graphics" object with the handle of that panel.
You'll need to read up on the Graphics classes, which contains many methods to draw similar like the Paint application does on your windows machine.
Hope this helps.
|
|
|
|
|
my table structures are
Customer
----------
CustomerID
FirstName
LastName
PhoneNo
Email
Order
--------
CustomerID
OrderID
OrderStatus
OrderDate
TotalPrice
OrderDetails
------------
ID
OrderID
ProductID
Qty
so now i have to show
CustomerID,FirstName,LastName,PhoneNo,Email and OrderCount
please give me a sample EF linq query
thanks
|
|
|
|
|
I'm curious, what do you think your query should look like? Have a try and come back with any problems that you encounter.
This space for rent
|
|
|
|
|
i write sql but not very good with linq to compose my below query. it will be great help if some one give me some hint
SELECT CustomerID,FirstName,LastName,PhoneNo,Email and count(*) as OrderCount
FROM Customers
INNER JOIN Orders ON Customers .CustomerID = Orders .CustomerID
GROUP BY CustomerID,FirstName,LastName,PhoneNo,Email
WHERE CustomerID=101
i compose this but take help from google search. see my sql and linq query and tell me does it give me my desired result
var data = (from c in db.customers
join o in db.orders
on c.CustomerID = o.CustomerID into subs
from sub in subs.DefaultIfEmpty()
group sub by new { c.CustomerID, c.FirstName,c.LastName,c.PhoneNo,c.Email } into gr
select new {
gr.Key.CustomerID,
gr.Key.FirstName,
gr.Key.LastName,
gr.Key.PhoneNo,
gr.Key.Email,
OrderCount = gr.Count(x => x != null)
}).ToList();
please help me if any rectification is required. thanks
|
|
|
|
|
Something like this should work:
var data = db.Customers
.Where(c => c.CustomerID == 101)
.Select(c => new
{
c.CustomerID,
c.FirstName,
c.LastName,
c.PhoneNo,
c.Email,
OrderCount = db.Orders.Count(o => o.CustomerID == c.CustomerID)
})
.ToList();
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
thank you so much sir for sharing right query with me
|
|
|
|
|
Hi friends,
I need good graphic library for C# ,is it available like QCustomPlot
|
|
|
|
|
I've searched everywhere and found in VB, but it does not work.
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim aakam031 As String = My.Computer.FileSystem.SpecialDirectories.Temp
Dim akam As String = aakam031 + "filename pashgr"
IO.File.WriteAllBytes(akam, My.Resources.file name)
Process.Start(akam)
End Sub
End Class
Anyone know how to do it in C #
modified 17-Jan-18 20:51pm.
|
|
|
|
|
Quote: it does not work. This is not a helpful error summary, - it tells us nothing bout what the problem is. All is says is "I have a problem" - but we know that already because you are asking a question!
The other things that don't help are:
1) Showing code that you didn't try - because VB code won't compile in a C# program we have no idea what actual code you did try
2) Not explaining what the code is meant to do: I have no idea what "open a flush" is supposed to mean!
So show us the code you tried; tell us what happened that you didn't expect, or didn't happen that you did; tell us what you did to cause that to happen; explain what you expected the code to do; Tell us what you tried to find out why it did what ti did. Have you used the debugger? If not, why not? If so, what did it show?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
So this code is to run a program that i, we carry inside the project, in that resource folder.
but he is like you and I want him as C # I put it to convert more it does not work
And it's not flush, the broker showed it wrong, I meant program or file
|
|
|
|
|
|