|
tapas1979 wrote: This returns 0 i.e. success.
Nope. Your GetModuleHandle prototype is missing SetLastError = true
|
|
|
|
|
Marshal.GetHINSTANCE(typeof(MyClass).Module)
|
|
|
|
|
I have a crystal report that displays records from a database.Each record has a number field "QTY". I want to display sum of each record in a page
suppose i purchase product 3 times in different dates
product qty
monitor 30
monitor 40
monitor 30
i want to display like this
product qty
moniter 100
thanks in advance.
|
|
|
|
|
You can do this using the designer in your crystal report file.
|
|
|
|
|
Hi all,
how to get tables and columns from existing sql server backup file without connect to SQL Server?
Is it possible to get table names and column names form raw file like *.bak ?
Please help me.............
Thanks
Venkat
|
|
|
|
|
I don't how to select without connecting
bud to get column names from a table use:
SELECT COLUMN_NAME AS Databasekolommen FROM INFORMATION_SCHEMA.COLUMNS WHERE (TABLE_NAME = 'tablename') ORDER BY ORDINAL_POSITION
and to get table names:
SELECT [TABLE_NAME]
FROM WorkDB.INFORMATION_SCHEMA.TABLES
hope it helps
|
|
|
|
|
is it possible to get table names and columns without using SQLServer?
that means can i get table names and columns from raw file(*.bak)?
|
|
|
|
|
For a little something I'm just playing around with today I need the ability for an instance to query the state of one or more other instances.
The various instances will therefore be chained together by some technique.
The important thing about this is that the state of the referenced (source) instance can change and the referencing (client) instance should always receive the current state.
A.Input = B.Output
B.Input = C.Output
A should always know the current state of C.Output
Passing the state by value won't work. I thought about using events, but I don't think they're appropriate for the task.
In C (or C++) I might pass the address (or a reference) to the state value, but that's not easily done in C# and I want it to be read-only to the client.
What I've come up with as a workable technique is delegates, which makes sense, I really want callback functions.
In the above example, C provides a delegate to a method that B passes along to A and A can call to get the state of C.
This works fine, and I'm just wondering whether or not anyone else has done anything like this and how they accomplished it.
|
|
|
|
|
I haven't needed this yet.
I see two ways that cascade:
1. polling
C offers a property that B can get; based on that B offers a property that A can get.
2. event driven
as A uses B and should be unaware of C, there must be a mechanism between A and B, probably an event; and similar a mechanism between B and C. So when C changes state, it tells its subscribers (B); and B getting such change, tells its subscribers (A).
And two ways that smash the cascade:
3. polling
define an interface, IMyProperty, and have both B and C implement it; now have B pass C to A as an IMyProperty. A doesn't care whether it is asking B or C then.
4. event driven
you could have B pass on the B->A delegate so it effectively becomes a C->A delegate however that complicates things a bit: B would need an AddEventHandler and RemoveEventHandler kind of methods, and keep the event itself private.
|
|
|
|
|
1. I'm doing that, the properties provide the delegate.
2. I have since realized that I probably need multi-cast ability so events may be needed.
3. That won't do it.
4. Except I think I need it to work in the other direction and I'm about to try it that way.
Edit: It works this way too. An output is a property that publishes a delegate and an input is an event (multicast delegate).
Outputs can be wired to inputs as required.
The receiving object only needs to execute the delegate(s) to determine the input value without caring where the value came from.
|
|
|
|
|
Arrg! It works until I create a loop, in which case I get infinite recursion and a stack overflow.
Ah, well, I think I can work around that.
|
|
|
|
|
You could always add some memory, 4 gigabytes come cheap these days.
|
|
|
|
|
Was happily coding away, and I did this:
if (blahblahblah)
{
.....
lock(blahblahblah)
{
.....
}
.....
}
I then realized I had gotten the scopes backwards, and corrected it. Is there any kind of switchscopeify feature somewhere in vs2008 to do that superquick?
|
|
|
|
|
|
right my aims are to create a kind of wizard , i dont know how to use the wizard class so i thought of some quick code for it and it didnt work *sigh* anyway so i have a tabcontrol on the gui (DotNetbar) and then once i open the first user control and on the first one call back to form1 with a public void for example :
public void SetPage(int PageNum)
{
if (PageNum == 1)
{
Page1 page1 = new Page1();
page1.Dock = DockStyle.Fill;
page1.AutoSize = true;
TabItem item = this.tabControl1.CreateTab("");
item.AttachedControl.Controls.Add(page1);
this.tabControl1.SelectedTab = item;
Application.DoEvents();
}
if (PageNum == 2)
{
Page2 page2 = new Page2();
page2.Dock = DockStyle.Fill;
page2.AutoSize = true;
TabItem item = this.tabControl1.CreateTab("");
item.AttachedControl.Controls.Add(page2);
this.tabControl1.SelectedTab = item;
Application.DoEvents();
}
if (PageNum == 3)
{
Page3 page3 = new Page3();
page3.Dock = DockStyle.Fill;
page3.AutoSize = true;
TabItem item = this.tabControl1.CreateTab("");
item.AttachedControl.Controls.Add(page3);
this.tabControl1.SelectedTab = item;
Application.DoEvents();
}
if (PageNum == 4)
{
ErrorPage error = new ErrorPage();
error.Dock = DockStyle.Fill;
error.AutoSize = true;
TabItem item = this.tabControl1.CreateTab("");
item.AttachedControl.Controls.Add(error);
this.tabControl1.SelectedTab = item;
Application.DoEvents();
}
if (PageNum == 5)
{
FinishPage finish = new FinishPage();
finish.Dock = DockStyle.Fill;
finish.AutoSize = true;
TabItem item = this.tabControl1.CreateTab("");
item.AttachedControl.Controls.Add(finish);
this.tabControl1.SelectedTab = item;
Application.DoEvents();
}
}
so the command on the form would be SetPage(1); for page 1 but for another on user control i would have it :
Form1 form = new Form1();
form.SetPage(3);
Application.DoEvents();
But it seems to not be loading, any help ? or anyone can point me to using the wizard as google for me doesent pull any help on it or unless i am searching it wrong , searching : c# code using wizard class ,
Anyway thanks for your time guys !
Jed
|
|
|
|
|
hi
where i can learn the basic of class - as simple as i can (C#)
class,get,set,OOP
thank's
|
|
|
|
|
Here is a recipe:
1. Read this[^];
2. Go to the bookstore, and choose, buy and study an introductory book on C#;
3. Read some articles here at CodeProject;
4. Experiment, and keep reading;
5. Ask intelligent questions at CP.
|
|
|
|
|
I have written a User Control and made it dll from a classLibrary Project.
This User Control get the Name of the Form (in Project that we use this dll) in textbox1 and then do something with the controls on this form. Now my question is how i can Cast textbox1.Text (of this user control) to Form ?
see i use this user control in FormA and when the project runs it gets any form name execpt itself(the form that has this user control) in textbox1 (this textbox1 is also in the user control)and then the user control brings out all control on that form and show all properties of that control.
I have used this code in User Control:
Type type = Type.GetType(txtFormName.Text, false, true);
Form frm = Activator.CreateInstance(type) as Form;
I get this error :
Value cannot be null.
Parameter name: type.
Alert :
This user control has been made in another project and i have build DLL and now I use this DLL in my another projects.
|
|
|
|
|
This has returned null :
Type.GetType(txtFormName.Text, false, true);
I think txtFormName.Text contains something bad, not a type name.
Maybe the type is contained in an assembly that is not loaded?
|
|
|
|
|
No
it contains windowsapplication4.Form1
|
|
|
|
|
It what assembly this type is contained?
windowsapplication4.Form1
|
|
|
|
|
Hi,
I am certain this question must have been asked many times before, but I am struggling to find a plain and simple answer to the following: can you get a wrapper (preferably 'thin') for OpenGL that can be used when developing C# code in Visual Studio to run on a PC?
I am sure I once read about something called 'SharpGL' but I don't seem to be able to find anything about it now. (Admittedly, I've only spent 30 minutes or so on this up to now, but I thought someone here might be able to point me in the right direction.)
Any pointers would be very much appreciated.
Best wishes, Patrick
|
|
|
|
|
Well there is the Tao framework, it's very thin, it just exposes the OpenGL functions to C# code and does some magic with ref/in/out parameters, but it's also huge
And there is CsGL, which is also very thin, but small, and unfortunately old stale and dead
And SharpGL, you only need 5 seconds to find it, see google
|
|
|
|
|
Thanks for the answer, but I am obviously been very thick here or I have a different Google to you (the former is more likely, I know) because all I can find, on about page 5 of the results, is a link from a thread here on CodeProject. The link allows you to download the wrapper, but I can't find any active website associated with it. The one mentioned in the thread, sharpgl.com, appears to be broken.
At least I now know I did not imagine SharpGL; I'll keep looking.
Best wishes, Patrick
|
|
|
|
|
I don't think it has an active website, but the websites of CsGL and Tao are zombies anyway - they haven't disappeared yet but they are not updated.
But I thought you needed a wrapper for OpenGL, not a website?
|
|
|
|