|
|
|
I am a new programmer! I have a little experiences of C# language. Can you give me some advice to learns this language well.
Thank you very much
Hello Informatics World
|
|
|
|
|
Hi,
You can learn c# 2.0 as it will be release any sooner probably this year.
Learn the C# features - e.g generics.
Learn how to use OOP + Design Patterns (Singleton) in C#.
Learn .NET Coding Best Pratices when you coding C#. Well there is a tool called FxCop. It will help you to analyze your code. It is quite useful.
Best to learn to walk before running.
Hope it helps. Cheers.
Regards,
Chua Wen Ching
Visit us at http://www.necoders.com
|
|
|
|
|
Hi,
Is it possible to wrap a dll A into another dll B, so I just need to distribute the dll B, but not the dll A? And how are there differences in
the following cases ?
1. the dll A is written in VC++, and the wrapping dll B is written in C#
2. the dll A is written in C#, and the wrapping dll B is written in C#
My concern is that I don't want others to get the original dll B when I distribute
the program. So can other people reverse engineer the wrapped dll and get the original dll out ?
Many thanks
|
|
|
|
|
No, that's not possible.
Something like this can only be done with static libraries that are linked with an executable.
With dlls you don't get code copied or linked directly, but only references to external functions.
That's the whole point of using dlls.
mav
|
|
|
|
|
Maybe you can buy an enterprise version of obfuscation and then obfuscate your assembly. It might confuse the crackers when reverse engineering your assembly.
And i don't think you achieve with what you want.
Cheers.
Regards,
Chua Wen Ching
Visit us at http://www.necoders.com
|
|
|
|
|
There is a messy way of embedded B.dll in A.dll as an embedded resources, extracting it using Assembly.GetManifestResourceStream , and then loading it into the AppDomain using several different methods depending on how you extract it or to where you extract it...but that's just dumb.
Why? For one, it creates a servicing hastle. Now you have to patch both by virtue of patching A.dll. Also, anyone else can extract it using outside code.
If you're worry about disassembly or decompilation, then you picked the wrong language. .NET languages and Java both compile to intermediate code (.NET to Intermediate Language (IL), and Java to bytecode). Even if you obfuscate it some can deobfuscate it just as easily.
If you truly want to hide an implementation, then you'll need to put that functionality into a native DLL (which still isn't impossible decompile, though extremely difficult expecially when optimized) and use P/Invoke or COM interop, which you can read more about in Interoperating with Unmanaged Code[^] in the .NET Framework SDK.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hi , I am trying to liken the ListView to a dataGrid..
Lets say we have a dataTable and a ListView..
In order to simulate dataGrid , we would like to known how many colums do we have , before binding the items into the ListView , I create the columns...
<br />
for ( int j =0 ;j<dTable.Columns.Count;j++)<br />
{ <br />
this.listView1.Columns.Add(dTable.Columns[j].ColumnName,-1,HorizontalAlignment.Center);<br />
}
Then , I consider to bind each dataRow into the ListView with the corresponding columns..
<br />
for ( int i = 0 ; i<dTable.Rows.Count;i++)<br />
{<br />
this.listView1.Items.Add(dTable.Rows[i][0].ToString());<br />
for ( int j =0 ;j<dTable.Columns.Count;j++)<br />
{ this.listView1.Items[i].SubItems.Add(dTable.Rows[i][dTable.Columns[j].ColumnName].ToString());<br />
}<br />
}<br />
Do you have any idea what I am doing wrong ?
|
|
|
|
|
You're adding the column name over and over again ?
It would help if you said what is actually GOING wrong. Why are you using a listview if you want a datagrid ?
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Thanks for the reply ,
May be because of the style of the text , you cant see right , I only add the columns to the listView in the first loop, then I add values to those columns..
well it seems like , the values are ok , by this code..But I guess , I made the ListView nervous , treating like a dataGrid.May be you are right, I was just looking for fun , and develop some UI skills...
<br />
StringBuilder s = new StringBuilder();<br />
foreach (ListViewItem li in this.listView1.Items)<br />
{<br />
s.Append(li.Text);<br />
for(int k =0;k<this.listView1.Items[li.Index].SubItems.Count;k++)<br />
{<br />
s.Append(this.listView1.Items[li.Index].SubItems[k].Text);<br />
s.Append("-");<br />
}<br />
s.Append("\n");<br />
s.Append("------------------------");<br />
s.Append("\n");<br />
}<br />
<br />
MessageBox.Show(s.ToString());<br />
|
|
|
|
|
ok , At last I found the reason, ColumnHeader Collection can not be work with listView(or I cant do it)
<br />
ColumnHeader [] h = new ColumnHeader[ColumnCount];<br />
<br />
for (int i=0;i<ColumnCount;i++)<br />
{<br />
<br />
h[i].Text=dTable.Columns[i].ColumnName;<br />
<br />
}<br />
this.listView1.Columns.AddRange(h);<br />
After I declare ColumnHeader one by one , it works fine..
Do you see any syntax or algorithm errors in Column Header Collection that I created?
|
|
|
|
|
it's not a collection, its an array as you have created it using array syntax.
Anger is the most impotent of passions. It effects nothing it goes about, and hurts the one who is possessed by it more than the one against whom it is directed.
Carl Sandburg
|
|
|
|
|
Because I need to use printPreviewDialog as preview only.
Pls show me the code to fix it.
Regard
Panthep
|
|
|
|
|
'Remove\Hide the print button.
Dim Strip_ToolStrip As ToolStrip
Strip_ToolStrip = Print_PrintPreviewDialog.Controls("ToolStrip1")
Strip_ToolStrip.Items("PrintToolStripButton").Available = False 'Remove
Strip_ToolStrip.Items("PrintToolStripButton").Enabled = False 'Hide
|
|
|
|
|
Thanks this approach worked, here is the code for C#
System.Windows.Forms.PrintPreviewDialog printPreviewDialog = new System.Windows.Forms.PrintPreviewDialog();
System.Windows.Forms.ToolStrip toolStrip = (System.Windows.Forms.ToolStrip)printPreviewDialog.Controls["ToolStrip1"];
toolStrip.Items["PrintToolStripButton"].Available = false;
Thanks
Saravanan J
|
|
|
|
|
How to I can get the rows selected in dataGrid when user make muli-selection on dataGrid.
Regard
Panthep
|
|
|
|
|
For x As Integer = 0 To Me.BindingContext(Datagrid1.DataSource).Count - 1
MsgBox(String.Format("{0} {1}", x, Datagrid1.IsSelected(x)))
Next
done
|
|
|
|
|
Hi,
I'm interested in learning how to retrieve CD information from a CD Drive in C#. I really only require the volume ID, to begin with. I suppose I can learn the rest myself once I've taken the first step.
Can anyone tell me the best way to learn how to do this?
eg.
- DLL References
- Classes
- Other URLs to sources that explain this
Many Thanks!
Tim
|
|
|
|
|
Sorry, I meant TOC, not volume ID
Cheers,
Tim
|
|
|
|
|
I have the following problem: i was trying to write a simple console application where the user enters a number and the program must show that number, as you can see is VERY VERY SIMPLE! but when the user enters the number, C# takes a wrong number, and gives that as the answer, here's an example of the code:
int i=0;
console.writeline("Enter a number: ");
i=console.read();
console.writeline("Your number is {0}",i);
i don´t know what the problem is, cause as far as i know I'm using a method that works for that!
Can anybody help me, please?
|
|
|
|
|
I think you should look at the return value of console.read() method , this method is for reading the next character , for not reading an integer..
string s = Console.ReadLine();
then cast the string into an integer value
int readInt=int.Parse(s);
console.writeLine("Your number is {0}",readInt.ToString())
the above code will read the int , and then show the user...
as I know..Hope it will work..
|
|
|
|
|
how can i use the serial port and treat with it
using c# to pass characters to it
|
|
|
|
|
|
Hi,
Look at the kernel32 writefile function.
There are many examples out there on communicating with serial port.
Hope it helps.
Cheers.
Regards,
Chua Wen Ching
Visit us at http://www.necoders.com
|
|
|
|