|
Ha good catch. That's what I get for stealing code from my old 1.0 framework projects....
You and your fancy 2.0 framework events... Like those will ever catch on
Latest toy built for fun: Web Lens
Best feature: Full size images when using Google image search.
|
|
|
|
|
no no...thats quite different things. I updated the question message with more info.
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Hi,
I don't know what exactly all this is, however:
1. I never felt a need to do what you do inside Form2_Activated()
2. There is a Shown event that could be useful.
3. I tend to give all my form a parent before or when showing them. That improves overall app behavior, such as child forms getting minimized together with parent forms.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Luc Pattyn wrote: 1. I never felt a need to do what you do inside Form2_Activated()2. There is a Shown event that could be useful.
I'm sure mate you didn't get my question
Shown event fires only when form pops up from hidden mode or when it appears first time.
I simply want that when Form2 has focus/activated then Form3 should also appear above Form1. Not only first time but all the time when it get focused. The above code works good if I used Show() but dont when ShowDialog() is used.
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Xmen W.K. wrote: I'm sure mate you didn't get my question
Quite the opposite, I understood your question well, my #1 statement is that would not cause me write the code you did write.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
then what should I need to write ? I'm stuck badly right now
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Hi,
Luc has already mentioned assigning a parent to each of the forms and I think that is all that needs to be done.
Form2 will always be above Form1 in the z-order as it is started as a modal dialog.
Form3 will display above Form2 if it has Form2 as it's parent, i.e. it is shown with f2.Show(this). You should remove the Activated event handler before making any changes as it's presence many well mess things up and cause a great deal of confusion.
Alan.
|
|
|
|
|
yes man I tried Owner property but there is another problem that if I set Form3's owner is Form2 then Form2 always behind Form3 now.
here is z-order I want
Form1 = 0
Form3 = 1
Form2 = 2
z-order with my code
Form3 = 0
Form1 = 1
Form2 = 2
z-order with Owner(i.e. f3.Owner = this; //this = Form2)
Form1 = 0
Form2 = 1
Form3 = 2
I tried Owner prop earlier and if it worked it could save my lots of code like hiding(Form3) from Alt+tab windows selector
any idea mate ?
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
cool, awesome, nice and mindblowing too... I got it working...
here is the working code
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
Form3 f3 = new Form3();
private const int GWL_EXSTYLE = (-20);
private const int WS_EX_TOOLWINDOW = 0x80;
private const int WS_EX_APPWINDOW = 0x40000;
[DllImport("user32", CharSet = CharSet.Auto)]
private static extern int GetWindowLong(IntPtr hWnd, int nIndex);
[DllImport("user32", CharSet = CharSet.Auto)]
private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int
dwNewLong);
private void Form2_Load(object sender, EventArgs e)
{
this.Owner = f3;
f3.Show();
SetWindowLong(f3.Handle, GWL_EXSTYLE, (GetWindowLong(f3.Handle,
GWL_EXSTYLE) | WS_EX_TOOLWINDOW) & ~WS_EX_APPWINDOW);
}
}
Thanks Alan for Owner advice...
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
As I said before and Alan confirmed.
And if by any chance that is insufficient, then the next step would be to call the Win32 function SetWindowPos at the right moment and using P/Invoke. However I haven't needed that in all those years that I am using .NET
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
thanks man for all your help
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
I am developing a mobile app using C#. After running app in Pocket PC 2003 SE emulator the application after about 5-6 minutes crashes giving error:
"A native exception has occured in abc.exe".
Exception code: 0xc0000005
and the debug output is:
'ABC.exe' (Managed): Loaded 'C:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\CompactFramework\2.0\v2.0\Debugger\BCL\mscorlib.dll', No symbols loaded.
'ABC.exe' (Managed): Loaded 'd:\dotnetapps\ABC\ABC\bin\debug\ABC.exe', Symbols loaded.
'ABC.exe' (Managed): Loaded 'C:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\CompactFramework\2.0\v2.0\Debugger\BCL\System.Data.dll', No symbols loaded.
'ABC.exe' (Managed): Loaded 'C:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\CompactFramework\2.0\v2.0\Debugger\BCL\System.dll', No symbols loaded.
'ABC.exe' (Managed): Loaded 'C:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\CompactFramework\2.0\v2.0\Debugger\BCL\System.Xml.dll', No symbols loaded.
'ABC.exe' (Managed): Loaded 'C:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\CompactFramework\2.0\v2.0\Debugger\BCL\System.Windows.Forms.dll', No symbols loaded.
'ABC.exe' (Managed): Loaded 'C:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\CompactFramework\2.0\v2.0\Debugger\BCL\System.Drawing.dll', No symbols loaded.
'ABC.exe' (Managed): Loaded 'd:\dotnetapps\ABC\ABC\bin\System.Data.SqlServerCe.dll', No symbols loaded.
'ABC.exe' (Managed): Loaded 'System.SR.dll', No symbols loaded.
A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll
A first chance exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll
A first chance exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll
A first chance exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll
A first chance exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll
A first chance exception of type 'System.FormatException' occurred in mscorlib.dll
A first chance exception of type 'System.FormatException' occurred in mscorlib.dll
The program '[6c91f87e] ABC.exe: Managed' has exited with code 0 (0x0).
Can someone please check this and help me to solve this issue. My app is continuously crashing because of it.
Thanks
_joseph_bashir
|
|
|
|
|
Member 115243 wrote: Can someone please check this and help me to solve this issue
And how can we do that, All you have posted is stack trace? All that can be done with this is confirm you have an issue with not having files, or the expected version of them, available to your application.
only two letters away from being an asset
|
|
|
|
|
There is an event ItemAdded that fires when an item is added but it do not fire when a sub item adds. eg.
ms.Items.Add();
ms.Items[0].DropDownItems.Add ();
Is there any way to do this ? Actually, I'm making a control using MenuStrip as base class and I need to execute some code(e.g setting ForeColor of new item) when any item adds in Menu or in its Items collection.
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Hmm, interesting. I've never needed to trap such an event so I don't know what's going on under the hood. Have you considered creating a custom event:
public class CustomMenuStrip : MenuStrip
{
//use this method instead of: DropDownItems.Add()
public void AddDropItem()
{
this.DropDownItems.Add();
OnDropDownItemAdded();
}
public event EventHandler DropDownItemAdded;
protected void OnDropDownItemAdded()
{
if (this.DropDownItemAdded != null)
this.DropDownItemAdded(this, null);
}
}
This maybe a shot in the dark but it may help you out.
Cheers,
Richard
If my answer has helped you, one of my articles may also be a help. Also remember that your best friend's name is google.
|
|
|
|
|
well, it will only work on runtime anyway I got something different that is I should add another Items Collection property like ItemsX that will have custom ToolStripItems collection
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Hi All,
I would like to be able to read and write directly to the NTFS and or FAT.
Can anyone point me in the correct direction to do this using c#, failing that c++
I wish to append extra information about the files and folders that is specific to my company.
many thanks for your help...
|
|
|
|
|
I dont know if this could be the solution to your problem (in NTFS anyway) but take a look at Alternate Data Streams[^]
A brief search gives this CP article ADSdotNET: A DLL for using alternate data streams from .net languages[^] in C++.
Maybe, if you have a bing about, you will find something in C#.
Hope this helps.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
thanks for that, very interesting...
i'll have to see if there is a way of using this from c#
|
|
|
|
|
Hi!
I am new to programming with SQL so I really need help on this one. After I finish an application with no errors or bugs, i tried to launch it in different computers. However, most computers encouter SQL errors while loading the application, either a timeout error or the application simply crashes due to the inability to load the data from an SQL database.
My questions are the following:
1. Do you need an SQL server running in the computer where you will deploy the application? Though in some computers, the application worked even though they do not have an SQL Server.
2. Should I modify something in the connection string when I am already deploying the software? Is there a difference in the connection string when the program is running in my computer and in other computers?
My connection string is this:
"Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\MyDatabase.mdf;Integrated Security=True;User Instance=True";
I tried modifying the timeout but the error still remains.
3. Where could I have missed something?
Sorry if I am missing something trivial here.
Thanks in advance for those who will respond! You'll really be helping me a lot.
Thanx!
|
|
|
|
|
labdakos wrote: Integrated Security=True
I would start by looking at the integrated security. When set to true the currently logged in windows user account will be used to try to access the server. If you haven't given the individual accounts permission to the database security could be stopping you.
You could fix this by setting the integrated security to false and then specifying a specific SQL UserID and password.
Latest toy built for fun: Web Lens
Best feature: Full size images when using Google image search.
|
|
|
|
|
Also doesn't look like you are specifying your server name in the connection string. SQL will only have to be installed on your server but the other machines need to know where that is.
This is a pretty good primer on connection strings: http://www.connectionstrings.com/sql-server-2005[^]
Latest toy built for fun: Web Lens
Best feature: Full size images when using Google image search.
|
|
|
|
|
Hello all i have the following structure of an XML documet:
<br />
<?xml version="1.0" encoding="utf-8" ?><br />
<config><br />
<Item><br />
<relais>255</relais><br />
<tijdIn>12:00</tijdIn><br />
<tijdUit>13:00</tijdUit><br />
</Item><br />
<Item><br />
<relais>255</relais><br />
<tijdIn>12:00</tijdIn><br />
<tijdUit>13:00</tijdUit><br />
</Item><br />
</config><br />
i need a (c#) code to read to document and load the items: Relais, TijdIn and Tijd uit in a different collum in a datagridview.
Because im new to XML i need your help! thank You!
|
|
|
|
|
|
I have written code to export content of DatagridView to Excel using Strem. It works but in some case some texts are found missing. And Numeric Datas are not formatted(i.e. while adding or calculating from exported data, unable to perform calculation. My code is like this:
public class ExcelReport
{
#region
private string Heading1;
private DataGridView Grid;
private int ReportType;
private int StartCol = 0;
private int StartRow = 0;
#endregion
#region Constructors
/// <summary>
/// Report Type:Excel=1,HTML=2,Word=3 and All=4
/// </summary>
/// <param name="_heading1"></param>
/// <param name="_grid"></param>
public ExcelReport(string _heading1,int _reportType, DataGridView _grid)
{
this.Heading1 = _heading1;
this.ReportType = _reportType;
this.Grid = _grid;
WriteReport();
}
#endregion
#region Main Function For Exporting
private void WriteReport()
{
SaveFileDialog saveFileDialog1 = new SaveFileDialog();
if (ReportType == 1)
{
saveFileDialog1.Filter = "Excel Worksheet files|*.xls";
}
else if (ReportType == 2)
{
saveFileDialog1.Filter = "HTML Files|*.htm";
}
else if (ReportType == 3)
{
saveFileDialog1.Filter = "Word Files|*.doc";
}
else if (ReportType == 4)
{
saveFileDialog1.Filter = "Excel Worksheet files|*.xls|HTML Files|*.html|Word Files|*.doc|All Files|*.*";
}
//Exporting To Different Formates using Stream
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
FileInfo fi = new FileInfo(saveFileDialog1.FileName);
StreamWriter sw = fi.CreateText();
sw.WriteLine("<table bgcolor='#FFFFFF' border=1 width='100%'>");
sw.Write("<tr>");
foreach (DataGridViewColumn col in Grid.Columns)
{
string FontName;
if (Grid.ColumnHeadersDefaultCellStyle.Font.Name.ToString() != null)
{
FontName = Grid.ColumnHeadersDefaultCellStyle.Font.Name.ToString();
}
else
{
FontName = col.DefaultCellStyle.Font.Name.ToString();
}
sw.Write("<th bgcolor='#ECE9D8'><FONT FACE='" + FontName + "'>" +ReplaceSpclChars(col.HeaderText) + "</font></th>");
}
sw.Write("</tr>");
//Fills cells of excel sheet by the content of grid view
int i=0;
for (i = 0; i < Grid.Rows.Count; i++)
{
sw.Write("<tr>");
for (int j = 0; j < Grid.Columns.Count; j++)
{
string FontName;
if (Grid.Columns[j].DefaultCellStyle.Font != null)
{
FontName = Grid.Columns[j].DefaultCellStyle.Font.Name.ToString();
}
else
{
FontName = Grid.DefaultCellStyle.Font.Name.ToString();
}
if (Grid[j, i].Value != null)
{
sw.Write("<td><FONT FACE='" + FontName + "'>" + ReplaceSpclChars(Grid[j, i].Value.ToString()) + "</font></td>");
}
else
{
sw.Write("<td><FONT FACE='" + FontName + "'>" + Grid[j, i].Value + "</font></td>");
}
}
sw.Write("</tr>");
}
sw.WriteLine("<b><Font Face='Shangrila Numeric' size='14px'>" + ReplaceSpclChars(Heading1)+ "</Font></b>\n");
sw.WriteLine("</table>");
sw.Close();
if (i > 1)
{
CrudeFx.MsgBoxNepali.Show(@";""rL PS;]ndf n}hfg] sfd ;DkGg eof] M", MessageBoxButtons.OK);
}
}
#endregion
}
private string ReplaceSpclChars(string fieldName)
{
fieldName = fieldName.Replace("<", "<");
fieldName = fieldName.Replace(">", ">");
return fieldName;
}
}
|
|
|
|