|
I guess there's no equivalent, boohoo! Why M$, whyyyyyyyy!
Sorry, getting slightly depressed from it.
Wout
(PS: And no, the AppDomain.AssemblyLoad thing is not what I want).
|
|
|
|
|
wout de zeeuw wrote: Why M$, whyyyyyyyy!
Because the .NET CLR doesn't support the necessary exports to support making a library .DLL lie you want. There are alternatives to the single method you want to use. It just depends on what you're doing.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I'm about to release a new component and I need to do some license checking on a coarse level. My initial idea was to just bomb out after the trial period in a sort of DllMain method.
Most of the code consists of structs for which performance is critical. That means I can't do any license checking or even static initializers in those. So if I can't do the license check in a DllMain, people can use it without restriction basically.
Wout
|
|
|
|
|
What's the main component which people will use, a class, a component a control etc?
I have no idea what I just said. But my intentions were sincere.
|
|
|
|
|
That's the tricky part, most of it is just vector, point and matrix structs (and in all honesty, that stuff isn't all that special, so I shouldn't worry too much about license checking that part).
And then there are a few classes for the somewhat bigger geometric stuff like polyline, polygon and triangulation classes, so I should probably settle for making some static initializers in those that do license checking.
I hope microsoft will give us component developers some better tools for protecting our software. They could have quite easily done something in the assembly and type loading department so developers could hook into it.
Wout
|
|
|
|
|
Aye things could be made a bit easier.
I have no idea what I just said. But my intentions were sincere.
|
|
|
|
|
Hi
How can I compare two points in c#? For example,
Point p1 = new Point(0, 0);
Point p2 = new Point(20, 20);
How do I p1 < p2 or p2 < p1? I know p1.equals(p2) to check whether both are equal. But how do I do <, >?
Thanks in advance
Muthu.
|
|
|
|
|
How do YOU define if a two-dimentional coordinate is less that (or greater than) another two-dimentional coordinate?
|
|
|
|
|
Basically, I have a panel in my form, and I want to capture whether my mouse is out of panel or inside panel. I dont want to use mouse_leave and mouse_enter.
so, when I capture panel's top-left and bottom-right I need to compare it with mouse pointer's coordination.
hope i explained clearly.
Thanks
Muthu.
|
|
|
|
|
What's wrong with comparing the x and y coordinates of the points?
Wout
|
|
|
|
|
The only thing you can really do is defining which is below or upper and left or right to the other. Is that what you want?
The notion of comparing 2 points defined by 2 dimensions coordinates is inappropriate in the context.
David Domingues at webrickco@gmail.com. Feel free to visit http://webrick.athost.net/index.php
|
|
|
|
|
is a point inside some rectangle ?
such a popular question must have a very simple answer:
bool Control.Bounds.Contains(Point)
Luc Pattyn
|
|
|
|
|
I need codes in C#. Net 2005 to help me establish relationship in some of my tables in SQL Server 2000. I need it because I want to be able to effect changes automatically in those tables based on change on one table.
I shall I appreciate if the codes are well commented.
Thank you
Banjo Ayorinde
|
|
|
|
|
Banjo Ayorinde wrote: I need it because I want to be able to effect changes automatically in those tables based on change on one table.
Then you need to use SQL, not C#. You create triggers to do the work you want.
|
|
|
|
|
I need assistant to create report using Crystal Report [C#.Net 2005) that allows users to select their parameters based on data in SQL 2000 Server.
e.g. Printing students whose date of birth falls within a selected dates.
What I really need is all the codes.
I shall appreciate if the codes are well commented.
Thanks
Banjo Ayorinde
|
|
|
|
|
I am using .net 2.0
The project has an mdi and several child forms...
running win xp pro.
I do not get the new visual style in .net 2.0
Any ideas please?
This is the code present is Program.cs
static class Program
{
///
/// The main entry point for the application.
///
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new CodexMainForm());
}
}
|
|
|
|
|
I have a fairly standard forms-based application with a lot of data-bound combos (DropDownList style) in it. Everything works fine except when the form is used to edit a 'new' object. In that case, all the form fields should be cleared. But combos dont show in cleared state, they just keep displaying the first value in the list. So now the user thinks that a value is already selected for him, but the application doesnt actually update the bound property of the object unless some other value is selected in the combo.
Lets say I have these two classes in my app.
<br />
class SelItem<br />
{<br />
public string Id { get; set; }<br />
}<br />
<br />
class MyObj<br />
{<br />
public SelItem Selection { get; set; }<br />
}<br />
To fill the drop down list of the combo i use (Id is a string property of the objects im passing through valuesList):
<br />
combo.DisplayMember = "Id";<br />
combo.DataSource = valuesList;
and using the forms designer I've bound the Text & SelectedValue of the combobox in this way (bindingSource contains a list of MyObj):
<br />
combo.DataBindings.Add(new System.Windows.Forms.Binding("SelectedValue", bindingSource, "Selection", true));<br />
combo.DataBindings.Add(new System.Windows.Forms.Binding("Text", bindingSource, "Selection.Id", true));<br />
Currently, I'm clearing the combo-boxes by setting their SelectedIndex property to -1 every time a 'new' form is launched, but thats just a hack. Anyone got an idea why isnt the combo taking care of this automatically.
|
|
|
|
|
Is it possible to access a remote registry using WMI's StdRegProv namespace using C#? If so could someone direct me to some examples? It seems it can be done using C++ and VBScript but I've yet to find some examples in C#.
Thanks in advance!
Parrish
|
|
|
|
|
I've got a problem with the following piece of code
Boolean retval = false;
StreamReader sr;
try
{
sr = new StreamReader(new FileStream(filename, FileMode.Open, FileAccess.Write));
sr.Close();
retval = true;
}
catch (FileNotFoundException e)
{
el.WriteEntry("Die Datei " + filename + " existiert nicht.", EventLogEntryType.Error);
}
catch (ArgumentException e)
{
Console.WriteLine("Der Stream konnte nicht gelesen werden.");
}
catch (IOException e)
{
Console.WriteLine("Datei noch nicht fertig geschrieben.");
return false;
}
finally
{
sr.Close();
return retval;
}
I can't access sr in the finally block. Why is that so? I thought try ... catch ... finally would make one construct. Same happens if I don't declare sr before the try.
-- modified at 4:12 Wednesday 17th January, 2007
|
|
|
|
|
In the finally block, you need to check that sr is not null before calling the Close method. This would become:
finally
{
if (sr != null)
sr.Close();
return retval;
}
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
You probably have to initialise sr before the try - plus use the method Pete suggested of checking for null.
StreamReader sr = null;<br />
<br />
try<br />
{<br />
sr = new StreamReader(new FileStream(filename, FileMode.Open, FileAccess.Write));<br />
}<br />
catch(Exception ex)<br />
{<br />
}<br />
finally<br />
{<br />
if(sr != null)<br />
sr.Close();<br />
}
|
|
|
|
|
Actually initializing it with null did the trick. I'va done too much PHP
Thanks
|
|
|
|
|
Hi!
I have a problem about Scope_identity function();
I've created a dataset with two table, parent and child.
I've configurated both tables with the wizard; in that way for each insert and update of my records I obtain the correct ID.
The problem is that the queries of the child table doesn't return the updated ID, after my inserting or updating in the SQL Server.
I've looked into into the DatasetDesigner.cs, and I've read the queries. Both Update and Insert query have the end-select.
What is the reason of the problem?
What is my error?
Thank you for answers.
|
|
|
|
|
Yes, it does work, but only if used properly. What does you C# code looks like that's expecting this to work? What does the SQL look like?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
this is the query:
this._adapter.InsertCommand.CommandText = @"INSERT INTO [P_OrdiniRighe] ([IdOrdine], [CodiceArticoloInterno], [CodiceArticoloEsterno], [CodiceFinitura], [CodiceVariante], [Quantita], [DataConsegna], [QuantitaConsegnata], [UM], [Prezzo], [Note], [QuantitaImpegnata]) VALUES (@IdOrdine, @CodiceArticoloInterno, @CodiceArticoloEsterno, @CodiceFinitura, @CodiceVariante, @Quantita, @DataConsegna, @QuantitaConsegnata, @UM, @Prezzo, @Note, @QuantitaImpegnata);<br />
SELECT IdRigaOrdine, IdOrdine, CodiceArticoloInterno, CodiceArticoloEsterno, CodiceFinitura, CodiceVariante, Quantita, DataConsegna, QuantitaConsegnata, UM, Prezzo, Note, QuantitaImpegnata FROM P_OrdiniRighe WHERE (IdRigaOrdine = SCOPE_IDENTITY())";
this._adapter.UpdateCommand.CommandText = @"UPDATE [P_OrdiniRighe] SET [IdOrdine] = @IdOrdine, [CodiceArticoloInterno] = @CodiceArticoloInterno, [CodiceArticoloEsterno] = @CodiceArticoloEsterno, [CodiceFinitura] = @CodiceFinitura, [CodiceVariante] = @CodiceVariante, [Quantita] = @Quantita, [DataConsegna] = @DataConsegna, [QuantitaConsegnata] = @QuantitaConsegnata, [UM] = @UM, [Prezzo] = @Prezzo, [Note] = @Note, [QuantitaImpegnata] = @QuantitaImpegnata WHERE (([IdRigaOrdine] = @Original_IdRigaOrdine) AND ([IdOrdine] = @Original_IdOrdine) AND ([CodiceArticoloInterno] = @Original_CodiceArticoloInterno) AND ([CodiceArticoloEsterno] = @Original_CodiceArticoloEsterno) AND ([CodiceFinitura] = @Original_CodiceFinitura) AND ([CodiceVariante] = @Original_CodiceVariante) AND ([Quantita] = @Original_Quantita) AND ([DataConsegna] = @Original_DataConsegna) AND ([QuantitaConsegnata] = @Original_QuantitaConsegnata) AND ([UM] = @Original_UM) AND ([Prezzo] = @Original_Prezzo) AND ([Note] = @Original_Note) AND ([QuantitaImpegnata] = @Original_QuantitaImpegnata));<br />
SELECT IdRigaOrdine, IdOrdine, CodiceArticoloInterno, CodiceArticoloEsterno, CodiceFinitura, CodiceVariante, Quantita, DataConsegna, QuantitaConsegnata, UM, Prezzo, Note, QuantitaImpegnata FROM P_OrdiniRighe WHERE (IdRigaOrdine = @IdRigaOrdine)";
They are generated automatically...
This is the function for updating e inserting
public static void UpdateParentChildObject(<br />
DataTable oParentTable, DbDataAdapter oParentTableAdapter,<br />
DataTable oChildTable, DbDataAdapter oChildTableAdapter)<br />
{<br />
DataTable tblChildDeleted = null;<br />
DataTable tblChildAdded = null;<br />
DataTable tblChildModified = null;<br />
<br />
try<br />
{<br />
tblChildDeleted = oChildTable.GetChanges(DataRowState.Deleted);<br />
if (tblChildDeleted != null)<br />
oChildTableAdapter.Update(tblChildDeleted);<br />
<br />
oParentTableAdapter.Update(oParentTable);<br />
oParentTable.AcceptChanges();<br />
<br />
tblChildAdded = oChildTable.GetChanges(DataRowState.Added);<br />
if (tblChildAdded != null)<br />
oChildTableAdapter.Update(tblChildAdded);<br />
<br />
tblChildModified = oChildTable.GetChanges(DataRowState.Modified);<br />
if (tblChildModified != null)<br />
oChildTableAdapter.Update(tblChildModified);<br />
<br />
oChildTable.AcceptChanges();<br />
<br />
}<br />
finally<br />
{<br />
if (tblChildDeleted != null)<br />
tblChildDeleted.Dispose();<br />
<br />
if (tblChildAdded != null)<br />
tblChildAdded.Dispose();<br />
<br />
if (tblChildModified != null)<br />
tblChildModified.Dispose();<br />
}<br />
}
Tell me if you need more information
|
|
|
|
|