|
Which development tool do you use?
|
|
|
|
|
I think, you can use osql command to run SQL script file from setup..
check-out this ...
http://www.thescripts.com/forum/thread476966.html
|
|
|
|
|
|
What is the good point of using this attribute?
this said,[^],
1. Code a new assembly (A2).
2. Move type T1 to from A1 to A2.
3. Remove T1 from A1. // Note by Michael Sync: We can't change the original namespace.
4. Reference A2 from A1
5. Add a TypeForwardedTo attribute to A1, pointing at T1 (now in A2)
6. Recompile A1 and A2.
7. Replace the original A1 with the new A1 and A2 (in the locations used by APP)
Since we have to reference A1 and A2, I didnt see any advantage of using this attribute..
Did I miss something here? It would be great if anyone explain me about the advantage of using this attribute with some examples.
Thanks in advance.
|
|
|
|
|
only use is when you have some legacy application (no source available, or cannot recompile for any other reason) referencing the type T1 originally located in A1 and for whatever reason you need to move the type out from that assembly.
Then you can do that mumbo-jumbo and you'll have your type happily moved out of A1 to A2, legacy binary still referencing the A1, but using type T1 from A2.
At least that's the reason for the attribute from my understanding.
Modify: Yes! And you need to know it for MS exams (the second reason why this attrib exists ).
|
|
|
|
|
thanks a lot for reply. geo_m.
geo_m wrote: some legacy application (no source available, or cannot recompile for any other reason)
We need to add A2 as a reference in Window Application after moving T1 from A1 to A2. isn't it? So, how to do that if that window application has no source code..
I think it can be done without this attribute.. right? We will move T1 from A1 to A2. Then, we will add A2 as a reference in window application. so, it's not necessary to have this attribute..
geo_m wrote: Modify: Yes! And you need to know it for MS exams (the second reason why this attrib exists ).
haha.. Yeah...
|
|
|
|
|
Okay. geo_m. I got you..
The main advantage having this attribute is that it's easy to move the type without recompiling the main application.
1. Code Class1 in (ClassLibrary1) assembly.
2. Add this ClassLibrary1.dll to Window application
3. Use ClassLibrary1.Class1 in window application
4. Code a new assembly (ClassLibrary2).
2. Move type Class1 to from ClassLibrary1 to ClassLibrary2. // Note by Michael Sync: We can't change the original namespace. So, we have to keep "ClassLibrary1.Class1" in ClassLibrary2
3. Remove Class1 from ClassLibrary1.
4. Reference ClassLibrary2 from ClassLibrary1
5. Add a TypeForwardedTo attribute to ClassLibrary1, pointing at ClassLibrary2(now in A2)
eg: in assembly.cs under properties of project view
[assembly: TypeForwardedTo(typeof(ClassLibrary1.Class1))]
6. Recompile ClassLibrary1 and ClassLibrary2 .
7. Copy new ClassLibrary1.dll and ClassLibrary2.dll. Replace the old ClassLibrary1.dll. Paste ClassLibrary2.dll
We dont need to touch Window application for adding ClassLibrary2.dll. Window application keep using ClassLibrary1. ClassLibrary1 will forword to ClassLibrary2. So, it's not necessary to recompile the window application..
Yeah. That's great...
Thanks again. geo_m
|
|
|
|
|
hi all,
Is there any functions to convert Stringed data into some kind of date type which can be used to pass into SQL INSERT for Timestamp type cell.
Thanks,
I'm writing WebApp if it makes difference.
|
|
|
|
|
DateTime.TryParse
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
If you're going to insert the dates into a database, you're better off keeping them as DateTime s, otherwise you will run into problems with internationalization. If you really want to insert them as strings, I suggest you insert them as yyyy-MM-dd .
Cheers,
Vıkram.
After all is said and done, much is said and little is done.
|
|
|
|
|
It's better send them as DateTime and convert the parameter in your query .
something like following code
// In C#
string dateTime = "12.12.2007";
SqlCommand cmd=new SqlCommand();
cmd.Parameter.AddWithValue("@currentDateTime", dateTime);
.
.
.
// In StoredProcedure or your query string
DECLARE @dateTime DateTime;
// Using Convert function to convert string data type to datetime data type
SET @dateTime = Convert(datetime,@dateTime);
DMASTER
|
|
|
|
|
Assume you know the date string format, example in format MM/DD/YYYY, or DD/MM/YYYY, or any format, you can write a common function to pass this string in, and output a value in date format.
You can get the function here --> http://www.oin1.com/Technical/CSharp/FormatDateString.htm[^]
Eliz.K
|
|
|
|
|
Hey guys,
I've installed my solution on a diffrent than development computer, everything works fine. However, the setup (Setup & Deployment project in VS) delivers a couple of additional files used in the app as content (backgrounds & stuff). However when you stop the application and change one of these files and then start the application again, MSI comes in to 'restore' the setup and then start the application
One of these files is an MDF (SQL database) file which is being attached during setup. Ofcourse this file changes and setup is restoring this file also... You can imagine that the app won't startup anymore.
How can I prevent the Microsoft Installer from restoring files after setup??
Thnx! Eduard
|
|
|
|
|
Hi, i need some help in figuring this out. i have a class as shown below:
public interface IDrawable<br />
{<br />
void Draw( Graphics g );<br />
int CountNo(ArrayList al);<br />
}<br />
<br />
public class Ellipse : IDrawable<br />
{<br />
public Color c = Color.Black;<br />
public Point l = new Point(0, 0);<br />
public Size s = new Size(0, 0);<br />
public int stroke = 0;<br />
<br />
public Ellipse( Color c, Point l, Size s, int stroke )<br />
{<br />
this.c = c;<br />
this.l = l;<br />
this.s = s;<br />
this.stroke = stroke;<br />
}<br />
<br />
public void Draw( Graphics g )<br />
{<br />
g.DrawEllipse( new Pen( c, stroke ), l.X ,l.Y, s.Width,s.Height );<br />
}
in the form:
<br />
private ArrayList alDrawingObjects = new ArrayList();<br />
.......<br />
alDrawingObjects.Add( new Rect( Color.Black, new Point(pt.X, pt.Y), new Size(50, 50), 5 ) );<br />
alDrawingObjects.Add( new Rect( Color.Black, new Point(pt.X, pt.Y), new Size(50, 50), 5 ) );<br />
.......<br />
private void form1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)<br />
{<br />
Graphics objGraphics ; <br />
objGraphics = e.Graphics;<br />
foreach ( IDrawable d in alDrawingObjects )<br />
{<br />
d.Draw( objGraphics );<br />
}<br />
objGraphics.Dispose();<br />
}
i need to be able to select with a mouseclick on any of the shape drawn. I thought of using Contain method but i don't know how to implement it. i know that i need to search through the array list and test if the mouseclick point or position is in the drawn shape. may i know how to implement this?
Thank u in advance.
|
|
|
|
|
cyn8 wrote: Graphics objGraphics ;
//You can't modify e.Graphics directly.
objGraphics = e.Graphics;
Bizarre. This is totally superfluous, AFAIK.
What you need to do is, in your mouse down event, iterate over the objects again, and check if the mouse is inside any of them.
Obviously, for an ellipse, you need to read up on the maths to find out if a point is inside an ellipse. One cheats way of doing it, is to create a new bitmap, draw the objects onto it in white, and check if your mousedown point is white or black as you draw each one. This is very inefficient, really should only be used where you can't work it out mathematically ( for example if you had a completely irregular shape )
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
<quote>What you need to do is, in your mouse down event, iterate over the objects again,...
can you explain further?
The problem is that for all the shape drawn before, i can't seem to save the area which they contained. if i mouseclick on the form, how can i check that the mouse click in within the area of the previously drawn shape. Please help, i've been cracking my head for hours.
Thanks
|
|
|
|
|
hi all,
pls somebody help me to load two combobox side by side on clicking a button(single click).i will attach my code.my code is building but i get the output with only one loaded combobox.another one remains empty
MY CODE:
DataTable table = new DataTable();
table.Columns.Add("SS");
DataRow row;
for (int i = 0; i < 10; i++)
{
row = table.NewRow();
row["SS"] = i + 1;
table.Rows.Add(row);
}
comboBox1.DataSource = table;
comboBox1.DisplayMember = "SS";
DataTable s = new DataTable();
s=table.Clone();
table.Columns.Add("SS1");
DataRow row1;
for (int j = 0; j < 10; j++)
{
row1 = table.NewRow();
row1["SS1"] = j + 1;
table.Rows.Add(row1);
}
comboBox2.DataSource = table;
comboBox2.DisplayMember = "SS1";
thank you,
saravana.
|
|
|
|
|
sowmyasaravanakumar wrote: another one remains empty
No. Just scroll down the comboBox2. You will see the new row that you just added..
Because of this line table.NewRow(); , new row will be appended to table1. So, first 10 rows of column "SS1" of table1 will be blank.
|
|
|
|
|
If you don't want to append new rows to table1 and you just want add one more column called SS1 and add the value then you may try the code below..
<br />
DataTable table = new DataTable();<br />
<br />
table.Columns.Add("SS");<br />
<br />
DataRow row;<br />
<br />
for (int i = 0; i < 10; i++)<br />
{<br />
row = table.NewRow();<br />
row["SS"] = i + 1;<br />
<br />
table.Rows.Add(row);<br />
}<br />
comboBox1.DataSource = table;<br />
comboBox1.DisplayMember = "SS";<br />
<br />
DataTable s = new DataTable();<br />
s = table.Clone();<br />
<br />
table.Columns.Add("SS1");<br />
int j = new int();<br />
foreach (DataRow dr in table.Rows)<br />
{<br />
dr["SS1"] = j++;<br />
}<br />
<br />
comboBox2.DataSource = table;<br />
comboBox2.DisplayMember = "SS1";
Hope it would help..
|
|
|
|
|
Hi all,
I'm trying to manipulate menuitems of a MdiParent from MdiChild, here's the code that i have
frmMain <- the MdiParent Form
private void Main_Load(object sender, System.EventArgs e)
{
frmsignon fs = new frmsignon();
fs.MdiParent = this;
fs.Show();
}
i'm trying the below code from my MdiChild form to manipulate the menus on my MdiParent form
private void frmSignOn_Load(object sender, System.EventArgs e)
{
frmMain fM = new frmMain();
fM.menuItem1.Enabled = false;
}
this code has no build errors, but it has no effect upon run time, the menuItem1 of my MdiParent form is still ENABLED.
What seems to be missing? Please help me make this work. Thanks in advance
-::maximus::-
|
|
|
|
|
use this.Parent
Form2 fr2 = (Form2)this.Parent;
and make menuItem1 public
but better approach is to make function in MDI parent to enable and disable menu item and call function in child using fr2.
|
|
|
|
|
Thanks ashuka
you mean changing the
frmMain fM = new frmMain();
to
Form2 fr2 = (Form2)this.Parent; ?
menuItem1 is already public.
-::maximus::-
|
|
|
|
|
yeah dear
Ashu
Ashish Kasama
|
|
|
|
|
Hmmm...
Im getting this error:
An unhandled exception of type 'System.InvalidCastException' occurred
Additional information: Specified cast is not valid.
my code on the MDIChild form looks like this now
private void frmSignOn_Load(object sender, System.EventArgs e)
{
frmMain fM = (frmMain)this.Parent;
fM.menuItem1.Enabled = false;
}
-::maximus::-
|
|
|
|
|
where you launch it
frmSignOn frm = new frmSignOn();
frm. MdiParent = this;
frm.Show();
and at the time of
private void frmSignOn_Load(object sender, System.EventArgs e)
{
frmMain fM = (frmMain)this.MdiParent;
fM.menuItem1.Enabled = false;
}
|
|
|
|