|
Plainly because they are for use only by the class, in it's internal workings.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
budidharma wrote: private struct PersistantData
{
int m_int1;
int m_int2;
}m_PersistantData; // I WOULD LIKE TO DEFINE AND INSTANTIATE THE STRUCT RIGHT HERE, INSIDE THE CLASS. IS THIS POSSIBLE?
You're doing two things at once.
private struct PersistantData
{
int m_int1;
int m_int2;
}
PersistantData m_PersistantData;
One more thing, unlike C++, C# structs have default access as private, so you'd need to make these int's public if you wanted to use them for anything
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thanks. I knew I could declare them like that, which is the way it's currently written, I was hoping for a shortcut to define and declare a single instance, since each class simply needs a single instance of each. Not necessary, just a little elegant.
And of course, you're correct - they are ONLY used within the internal structure of the class. I'm simply separating the data into catagories that they belong in.
|
|
|
|
|
You can't declare a struct inside a class, the same way you can't declare a struct inside a struct or a class inside a class.
---
b { font-weight: normal; }
|
|
|
|
|
You can declare classes and structs inside classes, as well as classes and structs inside structs.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Oh, you are absolutely right. Sorry about that.
---
b { font-weight: normal; }
|
|
|
|
|
... Yes, you can definately declare a struct inside a class.
|
|
|
|
|
Yes, S. Senthil Kumar already pointed that out.
---
b { font-weight: normal; }
|
|
|
|
|
I am trying to convert a picturebox into an ICO. I found out that it is a known bug that the ImageFormat.Icon does not encode the image correctly. Using this article: http://www.codeproject.com/dotnet/MultiIcon.asp I know how to encode the icon, the only problem is, that I need to get the image's raw bytes to write to the image. Does anybody have any idea how to do this or a better way to convert an image or png to an ico?
JGA
|
|
|
|
|
Hi there,
jgallen23 wrote: I found out that it is a known bug that the ImageFormat.Icon does not encode the image correctly
You might take a look on this article to get the solution
Icon
jgallen23 wrote: png to an ico
also take a look on this
Png2Icon
<< >>
|
|
|
|
|
enjoycrack wrote: You might take a look on this article to get the solution
Icon
here's are the problems with that article:
The source Bitmap must use PixelFormat.Format24BppRgb
The source Bitmap must use at most 256 colors
The source Bitmap must be 16x16 pixels
The target Icon must be 16x16 pixels
The pixel in the lower left corner (0, 15) is used to determine the transparency color
JGA
|
|
|
|
|
Hi
I am trying to design the Help feature, consisting of the tree view in one pain, and the explanation in the other, separated by a spliter. How can I create an HTML file, and how can I bind it to the explanation section? Do I use, textbox, etc...? Any help would be very valuable.
Thank you.
|
|
|
|
|
Hi all,
Im looking for a way (.net or not) to monitor file access and permit access to certain application to it...
I want to be able to get an event saying (this file) tries to do "this" to this file
Acess - Deny
Thanks
|
|
|
|
|
Please be more specific. Your problem is not really clear to understand. Or try to give an example of what you are looking for. That will help.
|
|
|
|
|
Something like Zone alarm
process XXX is trying to modify file (*.txt)
Allow / Deny
Be able to get every application that try to access a file
and
have the possibility to allow it to access it or not.
|
|
|
|
|
To do something like that, you have to hook into some pretty low-level system API's. Usually, such hooks require a windows driver to be written (most firewalls use kernel-level drivers with high priority to accomplish the task of allow/deny). If you try to do this at a higher level than kernel, people will easily be able to get by your app by writing their own kernel-level driver. I'd give you some examples, but its been years since I did anything like this, and I never got too deep into the theory anyway. So its a little beyond my league.
|
|
|
|
|
Hi all,
I have several config files in my application. In my app.config file, I currently have some entries that look like this:
<configurationsections>
<configurationsection name="options" encrypt="false">
<storageprovider xsi:type="XmlFileStorageProviderData" name="XML File Storage Provider" path="options.config">
<datatransformer xsi:type="XmlSerializerTransformerData" name="Xml Serializer Transformer">
<includetypes>
<configurationsection name="state" encrypt="false">
<storageprovider xsi:type="XmlFileStorageProviderData" name="XML File Storage Provider" path="state.config">
<datatransformer xsi:type="XmlSerializerTransformerData" name="Xml Serializer Transformer">
<includetypes>
<configurationsection name="main" encrypt="false">
<storageprovider xsi:type="XmlFileStorageProviderData" name="XML File Storage Provider" path="main.config">
<datatransformer xsi:type="XmlSerializerTransformerData" name="Xml Serializer Transformer">
<includetypes>
I would like to encrypt the main.config file in this example. I noticed that there is an encrypt="false" there. If I would like to encrypt it, how would I do that? I don't see anywhere where I can specify a password. Also, I would somehow have to get my existing decrypted main.config file in the new encrypted format. How would I do that?
Thanks a lot for your help!
|
|
|
|
|
Oops, looks like my xml tags got encoded as html tags and aren't visible. Well, essentially what I put there was the config file configuration section.
Again, thanks for your help!
|
|
|
|
|
You can use Microsoft Enterprise Library Configuration block to encrypt the config file. For details you can go to MSDN and search for Enterprise library configuration block or just google it. There will be tons of examples.
Thanks
|
|
|
|
|
I'm having problem with dataGrid bcs i want to implement on it DateTimePicker as first Column (Primery key) so plz if u can help me with a sample code
Best Regards
charbel
|
|
|
|
|
There are plenty of samples out there of hosting a DateTimePicker within a dataGridColumn. A quick google search pulled up many possibilities - im also 99% sure there will be one or more articles right here on CodeProject
Heres the google search
DateTime DataGridColumn[^]
Also, are you sure a DateTime is a good candidate for a PrimaryKey?
|
|
|
|
|
I am writing a guitar music display app, the sort with the chords above the words, you've all seen them! I'm making it do other stuff aswell as that, but prolly the main reason I'm doing it, is to get my head around programming C# and .NET. I learn better by doing.
I've knocked up a custom crontrol that can correctly display a chord, but I'm worried that a large song would have to have dozens of the controls throughout it and that seems wasteful to me. I was wondering if I could have one such control hidden on the form, use it to render the image of the chord, then copy that image onto the form page itself, above the words. Does that make sense? If this is not poss, can I do a control array, like I used to in VB6?
Also, any advise/tip you'd like to give me on scrolling? I'm just going to wwrite text and hopefully chord images directly to the form, so will have to be able to scroll the form and want it to draw quickly.
errr, help?
!!
Thanks in advance.
Jim
|
|
|
|
|
Hello,
I have a very large datasource, and the way I am exporting the dataset to Excel, is I go through each row and each column, and populate excel document cell, by cell. It takes a very long time. Is there a better way of exporting the dataset into Excel? Thank you.
|
|
|
|
|
Build a Table in HTML, write it to a textfile with a .xls extention and it'll open fine in excel. The slowness you descibe is interoperating with the Excel com object.
try this - copy and paste the below into notepad. Save it as test.xls (remember to choose all files, otherise notepad will name the file test.xls.txt) and now double click in explorer.
row 1 cell 1 | row 1 cell 2 | row 2 cell 1 | row 2 cell 2 |
|
|
|
|
|
Is it possible to do formating of the data in HTML format as well? Here is the code of mine that populates the excel sheet:
<br />
Microsoft.Office.Interop.Excel.ApplicationClass excel = new Microsoft.Office.Interop.Excel.ApplicationClass();<br />
Microsoft.Office.Interop.Excel.Range theRange;<br />
<br />
excel.Application.Workbooks.Add(true); <br />
excel.Visible = true; <br />
<br />
int ColumnIndex=0; <br />
foreach(DataColumn col in dataview.Table.Columns) { <br />
ColumnIndex++;<br />
if (ColumnIndex > 3) {<br />
excel.Cells[1,ColumnIndex-3] = styleSummary.GridColumnStyles[col.ColumnName].HeaderText;<br />
theRange = (Microsoft.Office.Interop.Excel.Range)excel.Cells[1,ColumnIndex-3];<br />
if (col.ColumnName == "Description") {<br />
theRange.ColumnWidth = 35.71;<br />
}<br />
theRange.Interior.ColorIndex = 15;<br />
theRange.Font.Name = "Arial";<br />
theRange.Font.Bold = true;<br />
<br />
<br />
} <br />
}
<br />
int rowIndex=0;<br />
foreach(DataRowView row in dataview) { <br />
rowIndex++; <br />
ColumnIndex=0; <br />
<br />
foreach(DataColumn col in dataview.Table.Columns) {<br />
ColumnIndex++; <br />
if (ColumnIndex > 3) { <br />
if (col.ColumnName == "Description") {<br />
excel.Cells[rowIndex+1,ColumnIndex-3] = this.getSpaces(level.Length)+row[col.ColumnName].ToString(); <br />
} else {<br />
excel.Cells[rowIndex+1,ColumnIndex-3]=row[col.ColumnName].ToString();<br />
} <br />
theRange = (Microsoft.Office.Interop.Excel.Range)excel.Cells[rowIndex+1,ColumnIndex-3];<br />
theRange.Font.Name = "Arial";<br />
theRange.Font.Size = 8;<br />
theRange.NumberFormat = "$#,##0";<br />
}<br />
theRange.Interior.ColorIndex = this.getColour(level);<br />
theRange.Borders.ColorIndex = 15;<br />
<br />
} <br />
}
}
Microsoft.Office.Interop.Excel.Worksheet worksheet = (Microsoft.Office.Interop.Excel.Worksheet)excel.ActiveSheet; <br />
worksheet.Activate();<br />
Is it possible to do the same formating in HTML, or build the text file?
Thank you
|
|
|
|