|
Exception is occurring in this method NOT the calling method. Same code is running fine on Windows 7. What happens in Windows 8.1? How do I diagnose this problem ?
|
|
|
|
|
Django_Untaken wrote: Exception is occurring in this method Where, and what are the exact details?
Django_Untaken wrote: Same code is running fine on Windows 7 If the above is an example of the code in this application then I suspect there may be any number of bugs waiting to be found.
|
|
|
|
|
The easiest way is to run the code under the debugger on Win8.
|
|
|
|
|
Aside from the obvious problem of catching and ignoring all exceptions, your P/Invoke declarations are wrong. I suspect the computer that's working is 32-bit, the one that's failing is 64-bit, and your application is compiled as "AnyCPU".
The correct declarations should be:
[DllImport("kernel32.dll")]
static extern IntPtr GetProcessHeap();
[DllImport("kernel32.dll")]
static extern void* HeapAlloc(IntPtr hHeap, uint dwFlags, UIntPtr dwBytes);
(Note the use of IntPtr and UIntPtr instead of int .)
http://pinvoke.net/default.aspx/kernel32/GetProcessHeap.html[^]
http://pinvoke.net/default.aspx/kernel32/HeapAlloc.html[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I'm using Visual Studio 2012 , is there any way i could get the metro UI for developing Windows Application using C#.
Please note that i need to create a windows application not Windows store App.
Please guide.
|
|
|
|
|
Well, there are some open-source projects, and some commercial components, that simulate the Metro UI for WinForms: [^].
«A man will be imprisoned in a room with a door that's unlocked and opens inwards ... as long as it does not occur to him to pull rather than push» Wittgenstein
|
|
|
|
|
|
And what's best is the free one is in VB.
/ravi
|
|
|
|
|
Why shouldn't i try that. is there an issue or something.
Coz i thought that we could make our form look much more professional when compared.
|
|
|
|
|
In my humble opinion, Metro isn't professional. I don't know of 2 people in the same room that like it.
|
|
|
|
|
Can u suggest me an alternative method to make my form look profesional.
|
|
|
|
|
|
no other Way other than that..
|
|
|
|
|
Really, how is anyone supposed to answer that question where we know nothing about your app or what your skill set is or what your app even looks like now?
|
|
|
|
|
If you need it looks like professional, you must need a professional to do it. If you really want to do it by yourself, then, third party UI controls like Telerik, Dev Express are the best solution.
|
|
|
|
|
|
I tried that , i think the .dll files in those are missing.
If u come to know any of the working the solution would like to know.
Thank you so much.
|
|
|
|
|
There are many third party libraries that allows you to do achieve it. Google them.
But you can create a simple Metro UI yourself in the windows form application.
See the 'calculator' and 'Sticky notes' app that I have made here "geekattech.blogspot.com".
|
|
|
|
|
could you guide me on how u did that and how should i do
|
|
|
|
|
class product
namespace EssentialTools.Models {
public class Product {
public int ProductID { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public decimal Price { get; set; }
public string Category { set; get; }
}
}
class LinqValueCalculator
using System.Collections.Generic;
using System.Linq;
namespace EssentialTools.Models {
public class LinqValueCalculator {
public decimal ValueProducts(IEnumerable<Product> products) {
return products.Sum(p => p.Price);
}
}
}
The ShoppingCart Class
using System.Collections.Generic;
namespace EssentialTools.Models {
public class ShoppingCart {
private LinqValueCalculator calc;
public ShoppingCart(LinqValueCalculator calcParam) {
calc = calcParam;
}
public IEnumerable<product> Products { get; set; }
public decimal CalculateProductTotal() {
return calc.ValueProducts(Products);
}
}
i dont understand logic code ...plz help me .Thank you
|
|
|
|
|
There is no "logic code" there - it's just blank classes except for one very simple line.
Are you trying to say "I don't understand this line of code:
return products.Sum(p => p.Price); Because if so, it's pretty trivial.
It uses a Linq method to return the total sum of all the Price properties of each item in the products collection. It's the equivalent of saying:
double total = 0.0;
foreach (Product p in products) total += p.Price;
return total;
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
using System.Collections.Generic;
namespace EssentialTools.Models {
public class ShoppingCart {
private LinqValueCalculator calc;
public ShoppingCart(LinqValueCalculator calcParam) {
calc = calcParam;
}
public IEnumerable<Product> Products { get; set; }
public decimal CalculateProductTotal() {
return calc.ValueProducts(Products);
}
}
}
and line calc.ValueProducts(Products); =>>>i dont undertand ...plz help me
modified 4-Jan-15 5:12am.
|
|
|
|
|
You are joking, right?
It calls an method on the LinqValueCalculator instance and passes it a collection of products.
I don't mean to sound rude here, but if you don't understand that simple code, then seriously you need to go right back to first principles and review the basics of C# coding - you aren't ready to start looking at complex stuff yet, and certainly nothing that involves lambda expressions.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
hi i am newbie ...thank you bro
|
|
|
|
|
There is a Products collection that contains Product objects.
Each Product object has some properties e.g. Price, Description, Category etc.
The ShoppingCart class calculates the total price of various products using LinqValueCalculator class.
What is missing in your code here is the class that instantiates ShoppingCart .
This class would be responsible for instantiating ShoppingCart and LinqValueCalculator .
|
|
|
|