|
We have some great introductory articles here on CodeProject written by Nishant Sivakumar. In the site menu on the side of the page under "Chapters", click "Languages" and then click "C++ / CLI"
led mike
|
|
|
|
|
Is there any difference between the two? I couldn't find simple tutorial Thanks
|
|
|
|
|
Sections 1.6.7.4 and 10.8 of the C# spec cover events.
An event is basically a property whose type is a delegate.
|
|
|
|
|
hi
in my main app, i was set app icon, then create new solution (setup application), and add my app files to it, and build my setup app, but when i test setup app, my app icon lost in exe file, why and how to solve my problem ?
thanks.
|
|
|
|
|
I have had this issue in the past as well. What I did is I added the icon to the resources directory of the project, then set the icon to be included as CONTENT in the resulting exe (through the properties window). Then use this icon (the one in the resources directory) as the one for the project. Be sure that if you want to use this icon on shortcuts that you include it in the application directory, and set the Icon property of the shortcuts to be the icon in that directory. Let me know if I need to explain this any more.
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
thanks for reply
do your intent is that i must add my icon to resource directory of my main app and in my solution, set build action to embedded as resource in properties window ?
thanks
|
|
|
|
|
I don't think it matters if it is in the resource directory or not, but yes, I do think that you either must copy it to the output directory or use it as embedded content. Otherwise, for some reason installing through setup does not maintain the image.
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
thanks for reply
but when i use installShield, it is make setup without any problem!
|
|
|
|
|
I'm glad you got it working.
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
Hi all,
I've got a System.Version field which I'm accessing from a property thusly:
[XmlRootAttribute(ElementName="quote", IsNullable=false)]
public class QuoteData
{
[XmlAttributeAttribute( DataType = "dll_version" )]
public Version DLLVersion
{
get
{
return dllVersion;
}
set
{
dllVersion = value;
}
}
private Version dllVersion = new Version();
}
but when I try to serialize it I get the error: "There was an error reflecting property DLLVersion". Any suggestions as to what's causing the error?
TIA.
|
|
|
|
|
hey guys, got a problem over here which i cant seem to solve. i have 1 picturebox displaying an image, and the second thats drawn on top of it, does not allow the bottom one to show through. what can be done to resolve this. will i have to resort to drawing my complex shapes with gdi?
|
|
|
|
|
There is no dilemma, whenever you are not sure a PictureBox can do what you want, well it can't.
what magic is it you expect a PictureBox to offer? it is a rather stupid Control, often not worth
the trouble. If you need more than just show a single Image, forget about a PictureBox, and
paint/draw whatever it is you need on your Form or on a Panel directly.
Yes, that takes GDI+ to do it, but then you get what you want, without disappointments.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Hi,
I have developed a code to write into a .csv file with comma delimiter.
Not sure why I do not get each recor into one complete line.
At present, the first three fields appear in row 1, then the next few into row 2 and some in column 3...
Not sure what I am doing wrong.
Thanks
StreamWriter textOut =
new StreamWriter(
new FileStream(path, FileMode.Create, FileAccess.Write));
for each record
textOut.Write(SecurityPricing.Security_ID + ",");
textOut.Write(SecurityPricing.Security_Name + ",");
textOut.WriteLine(SecurityPricing.Bid_Source + ",");
...
...
...
|
|
|
|
|
arkiboys wrote: Not sure what I am doing wrong.
This is happening because you are writing one column at a time to your file. You need to be writing one row at a time. This example loops through the rows of a table, then loops through the columns, adds the value to a string, and tacks on a comma at the end, then goes to the next. When it is done with all the columns in a row, it writes the row to the file, and moves on to the next. Hope this helps.
for (int r = 0; r < someTable.Rows.Count; r++)
{
for (int c = 0; c < sometable.Columns.Count; c++)
{
strWriteText += string.Format("{0},", someTable[r][c].ToString());
}
File.AppendAllText(strFilePath, string.Format("{0}{1}", strWriteText, Environment.NewLine), Encoding.UTF8);
strWriteText = string.Empty;
}
I'm going to become rich when I create a device that allows me to punch people in the face over the internet.
"If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer
|
|
|
|
|
I do not get one column per row. As explained, I get the first three fields in the first row, then each column in a separate row.
This is what I have in case you spot anything. Thanks
public static void SavePrices(List<clsSecurityPricing> securities)
{
// if the directory doesn't exist, create it
if (!Directory.Exists(dir))
Directory.CreateDirectory(dir);
// create the output stream for a text file
StreamWriter textOut =
new StreamWriter(
new FileStream(path, FileMode.Create, FileAccess.Write));
// write each Security Price...
foreach (clsSecurityPricing SecurityPricing in securities)
{
textOut.Write(SecurityPricing.Security_ID + ",");
textOut.Write(SecurityPricing.Security_Name + ",");
textOut.WriteLine(SecurityPricing.Bid_Source + ",");
textOut.WriteLine(SecurityPricing.Bid_Size_Best_Latest + ",");
textOut.WriteLine(SecurityPricing.Bid_Price_Best_Latest + ",");
textOut.WriteLine(SecurityPricing.Ask_Price_Best_Latest + ",");
textOut.WriteLine(SecurityPricing.Ask_Size_Best_Latest + ",");
textOut.WriteLine(SecurityPricing.Ask_Source + ",");
textOut.WriteLine(SecurityPricing.Bid_Price_Best_AllDay + ",");
textOut.WriteLine(SecurityPricing.Ask_Price_Best_AllDay);
}
// write the end of the document
textOut.Close();
}
|
|
|
|
|
Check here:
arkiboys wrote:
. . .
textOut.Write(SecurityPricing.Security_Name + ",");
textOut.WriteLine(SecurityPricing.Bid_Source + ",");
. . .
Write writes the specified string to the stream, WriteLine writes the string to the stream and then appends a New Line.
|
|
|
|
|
|
Ew; other than his mistaken use of WriteLine rather than Write, his is better than yours.
|
|
|
|
|
Hi!
According to MSDN by using MethodInfo.Invoke I can invoke public properties. But how about methods having Internal or Private access modifiers? Is there a way that I can Invoke them?
Thanks!
|
|
|
|
|
Yes. Once you get the methodinfo you are able to invoke them reflectively, but you need to have permission to do so. For example, you can't invoke private member 'foo' of class 'A' from any other class (I think, but I am CERTAIN that you can invoke 'foo' from within class 'A' because I have done it).
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
Hi!
With the help of BindingFlags I managed to do what I need. So, you can get a private, internal, or basicaly non-static methods by using BindingFlags parameters either from the same class or from a different class.
The code below writes "ClassA's internal Method1 invoked." two times on the console.
Thanks!
class ClassA
{
internal void Method1()
{
string message = "ClassA's internal Method1 invoked.";
Console.WriteLine(message);
}
public void MethodInvoker ()
{
Type typeOfClassA = (new ClassA()).GetType();
//GET the internal Method1 of ClassA:
MethodInfo methodToInvoke = typeOfClassA.GetMethod"Method1",BindingFlags.Instance|BindingFlags.NonPublic);
methodToInvoke.Invoke(this, null);
}
}
class ClassB
{
public static void InvokeMethod2InClassA ()
{
ClassA classAObject = new ClassA();
Type typeOfClassA = classAObject.GetType();
//GET the internal Method1 of ClassA from ClassB:
MethodInfo methodToInvoke = typeOfClassA.GetMethod("Method1", BindingFlags.Instance | BindingFlags.NonPublic);
methodToInvoke.Invoke(classAObject, null);
}
}
class Program
{
static void Main(string[] args)
{
ClassA invoker = new ClassA();
invoker.MethodInvoker();
ClassB.InvokeMethod2InClassA();
Console.ReadLine();
}
}
|
|
|
|
|
Hmmm, very interesting. I had no idea you could invoke methods using reflection that you otherwise would not have access to. I knew you could FIND the private methods of other classes in the way you presented, but I expected the environment to throw an exception if I tried to invoke them. Anyway, this is very interesting. Just as an aside, I feel obligated to tell you that there is an operator "typeof" that can get the type of a class without you needing to instantiate it. Therefore, you can convert "(new ClassA()).GetType()" to "typeof(ClassA)". This alleviates you from needing to instantiate, then throw away, some class.
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
If ClassA and ClassB are in the same file, then ClassB has access to ClassA's internal members anyway, so there's nothing unusual going on here.
|
|
|
|
|
Someone on here has said you can, but I still don't believe it.
|
|
|
|
|
Hi,
I've implemented DragDrop functionality between two DataGridViews using the MouseDown event. The problem is both Grids have DataGridViewCheckBoxColumns and DataGridViewComboBoxColumns, which require that the user be able to click on the objects contained in those columns and change them as needed. The MouseDown event is preventing these objects from reacting to the user's MouseClick. I need a way to implement DragDrop between two grids without disrupting the DataGridView's ability to handle normal MouseClick events. I'm looking for a different event that could be used to handle the DragDrop. Any help is appreciated. Thanks!
|
|
|
|
|