|
Hello
I have a little problem(quite anoying actually) with databound datagridview.
I have continued working on somebody else’s project and it is quite hard.
The grid has 5 columns, and all of them are DataGridViewTextBoxColumns(all are databound), and
everything works fine. The grid loads entries from the database and so on.
I have to change somethings now to satisfy my boss.
I sholud add some empty rows(I can do that) and in the added rows the first cell sholud be a
DataGridViewComboBoxCell instead of DataGridViewTextBoxCell.
Is this possible with databound gridview?
I have tried but cannot get it to work right. can you help me please, I’m quite desperate now. Is
it possible to exchange private messages with you. I’m grateful in advance for any help you can
offer. Best regards, Linn
|
|
|
|
|
i have some experience..not necessarily good.. with the winforms datagrid in .NET 1.1, and as far as i could tell you couldnt change the type of column on a per row basis...i.e. if col1 is a textbox in row 1 it will be a textbox in any other row...same for the other controls...to change what a column is you have to define the template here's an example from .net 1.1 and c#
bool columns are checkboxes if you were wondering..i assume there's a control for a combobox or ddl, but i didnt use it. sorry about the formatting..
private void AddCustomDataTableStyle()<br />
{<br />
DataGridTableStyle ts1 = null;<br />
DataGridBoolColumn boolCol = null;<br />
DataGridTextBoxColumn textCol = null;<br />
<br />
ts1 = new DataGridTableStyle();<br />
ts1.MappingName = "name";<br />
<br />
ts1.AlternatingBackColor = Color.LightGray;<br />
ts1.GridLineColor = Color.Black;<br />
<br />
ts1.SelectionBackColor = Color.Blue;<br />
ts1.SelectionForeColor = Color.White;<br />
<br />
ts1.RowHeaderWidth=15;<br />
this.dgSettings.RowHeaderWidth=15;<br />
<br />
boolCol = new DataGridBoolColumn();<br />
boolCol.MappingName = "Auto";<br />
boolCol.HeaderText = "Auto";<br />
boolCol.Width = 50;<br />
boolCol.AllowNull = false;<br />
boolCol.TrueValue = true;<br />
boolCol.FalseValue = false;<br />
<br />
ts1.GridColumnStyles.Add(boolCol);<br />
<br />
textCol = new DataGridTextBoxColumn();<br />
textCol.MappingName = "lastModified";<br />
textCol.HeaderText = "Modified";<br />
textCol.Width = 110;<br />
textCol.ReadOnly=true;<br />
ts1.GridColumnStyles.Add(textCol);<br />
<br />
dgSettings.TableStyles.Add(ts1);<br />
<br />
TablesAlreadyAdded = true;<br />
}
hope this helps some
|
|
|
|
|
Hi all ,
is there any way to increase the message box size ,like 1/4 of the desktop .
thanks ,
CSN
|
|
|
|
|
Changing the default message box is not possible. You can write your own message box.
|
|
|
|
|
|
is it possible to program windows using C# , and calling the winAPI functions or the msgina functions from the code ,
help is needed
thanks in advance
There is always something to learn
|
|
|
|
|
What do you mean by "program windows using C#"? It's possible to develop applications that run on windows and to call winapi functions using P/Invoke[^] As for msgina, function from this dll are used when windows is loading and a user logs in so why would you want to call its functions?
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|
|
Do you want to make your programs with C# and also use of API functions?
|
|
|
|
|
It seems like the source code for most assemblies can be obtained through Lutz Roeder's Reflector or similar tool.
Therefore, if a company develops a new product in .NET, is there any way for the company to prevent another company from simply viewing the product assemblies through Reflector and obtaining the source code for themselves?
|
|
|
|
|
|
Member 3919049 wrote: Therefore, if a company develops a new product in .NET
... it is highly unlikely that they are in need of protecting said code.
led mike
|
|
|
|
|
|
Member 3919049 wrote: It seems like the source code for most assemblies can be obtained through Lutz Roeder's Reflector or similar tool.
You seem to misunderstand what reflector is doing (or what source code is).
Reflector does not give you the source code back. It shows you what the IL generated is and it can convert that IL into C# or VB.NET so it is easier to read. It does not, and cannot, give you back the original source code. The compiler will have made various optimisations and so reflector shows you those, because it does not know what the original was. It can only ever see what the final result is.
|
|
|
|
|
Colin Angus Mackay wrote: does not, and cannot, give you back the original source code
I have seen a plug-in for reflector which extracts the code into a file.
Colin Angus Mackay wrote: The compiler will have made various optimisations and so reflector shows you those, because it does not know what the original was. It can only ever see what the final result is.
I am not sure, but I think compiler won't make any changes to the source code. It generates equivalent IL and reflector is capable to show it in languages like C# , VB etc, Right ?
|
|
|
|
|
What Colin has said stands. It cannot return your original code. Sometimes the compiler optimizes your code in the compilation process, and a utility like Reflector returns you code based on the optimized version.
|
|
|
|
|
Although it isn't the exact original code,
the code generated by the Reflector can still reveal the business logic you have used.
So obfuscating could make it a little harder to understand what is going on.
codito ergo sum
|
|
|
|
|
It's new information for me. Can you tell me an example for the optimizations done ? I have checked our applications with reflector and can't find any changes in the code.
|
|
|
|
|
Do an If\then\else statement in VB like this:
Dim i As Integer = 3
If i = 1 Then
Console.WriteLine "1"
ElseIf i = 2 Then
Console.WriteLine "2"
ElseIf i = 3 Then
Console.WriteLine "3"
EndIf
You will most likely see that it gets shown to you in Reflector as a case statement.
Things like that...
|
|
|
|
|
Interesting. It shows case statement like
Select Case 3
Case 1
Console.WriteLine("1")
Exit Select
Case 2
Console.WriteLine("2")
Exit Select
Case 3
Console.WriteLine("3")
Exit Select
End Select Compiler changed the code. But the case statement generated looks bad, isn't it ? In this case why don't compiler generate something like Console.WriteLine("3") alone since it knows only 3 will be printed. I am just wondering
I tried slightly altered below code
Dim i As Integer = 3
If (i = 1) Then
Console.WriteLine("1")
ElseIf (i = 2) Then
Console.WriteLine("2")
ElseIf (i = 3) Then
Console.WriteLine("3")
Else
Console.WriteLine("none of them")
End If
Console.Read This will be compiled as it is. No changes are made.
Thanks for clearing doubt.
|
|
|
|
|
Remember though, the compiler did not really change the code, it just built the underlying IL in a way that when Reflector reversed it this is how it was structured.
Not sure if I agree that the case statement is worse or better than the if statement really although I question the real need for the Exit Select parts there.
If you change the if statement to take into account multiple conditions like this:
Dim i As Integer = 3
Dim test As Boolean = True
If (i=1) And (test = True) Then
You will see that Reflector keeps this as an If statement. Have not looked at the resulting IL closely but I just suspect that the IL for the first If is better (more efficient) coded as a case than an IF (maybe less tests?) and as you add conditions that efficiency looses it's value so it is built differently. I am not a compiler expert so I can't say for sure there.
|
|
|
|
|
The CodeProject occasionally gives out the Spices Obfuscator in the article competitions and it can be used to scramble the assembly to make it 'harder' for others to crack it.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
VS.Net ships with Dotfuscator Community Edition.
Look in your Tools menu.
|
|
|
|
|
Hi
Iam doing windows application using c#..
when i build the application...it's sucessfully build..
and run the application (Ctrl+f5) with out debugging mode..
it's giving error---
system.InvalidoperationException occured in .exe[3660].Just-in-time debuging exception failed..
but when i run the application in Debugging Mode F5 it's working Fine...
I think the problem is in my
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
mainform form = mainform.GetInstance();
Application.Run(form);
}
please give me solution where the exact problem is ?
murali krishna
|
|
|
|
|
Without knowing what are you doing in mainform we can't help.
|
|
|
|
|
hi there,
i developed a complex windows form application which contains a lot of controls (textbox, combobox). I use following code, when i've to change their text properties:
this.mytextbox.text = "smth";
considering that i've more than 50 textboxes and comboboxes, i'd like to know if there is another way to write down more efficient and structured code.
I was thinking about using a pattern (i remember to have read in codeproject something like that, but i still haven't found the article).
best regards.
|
|
|
|