|
Ill do all your advices and forget my question.
as we can delegate for example a textBoxes between
forms, I want to know how can we delegate arrays
between forms.
|
|
|
|
|
You mean you want to pass the information from one form to the next?
You can do so by passing it through the constructor or via using a property.
V.
|
|
|
|
|
I've got an issue with my MDI child forms, where the form objects 'contain' data from previous instances.
I'm assuming its relating to the fact that when I open the form from the MDI parent I use the following:
frmDTC frm = new frmDTC(true);
frm.MdiParent = this;
frm.Show();
I think the errors are occurring because I don't dispose of frm. Usually I would use using , but that will close the form instantly.
So should I do something like:
frm.FormClosed += (s, ev) => frm.Dispose();
Or should this be in the form class itself?
Or have I missed something else...and the user closing the form should mean it gets disposed eventually...and I've got something else stopping it.
|
|
|
|
|
Dispose won't remove references that you've added (as fields of your form object). And yes, closing a form will generally immediately Dispose it as well, so this is probably not your problem.
My guess is you're storing frm in a collection somewhere, and not removing it when the form is closed. You can either ditch that collection entirely and use MdiChildren, or you need to add a close handler to remove subforms from any collections in your code.
|
|
|
|
|
mmm, I'm not adding it to any collection explicitly. (I do set the MDIParent property though, does this add it to any collection on the MDIParent form??)
No subforms are loaded during the lifetime of the form, and there's no complex class-level variables to dispose of either. It's a 'basic' dataset bound form.
|
|
|
|
|
This is my Stored Procedure i want to implement paging where i will get the page size as a parameter from UI..How do i implement paging in this query
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
-- =============================================
-- Author: <ragesh nair="">
-- Create date: <11/04/2012>
-- Description: <search>
-- =============================================
--exec iSRPDb_Sp_Search_WO 1,0,'0','T',10,1
--select * from tblProject where ProjectID=13849
--select * from tblProject where ProjectID=22412
--select * from tblProject where ProjectCode='B20904'
--select * from tblSubContractor where SubContractorID=88420
--select top 10* from tblWorkOrderHeader where ProjectID=22412
ALTER PROCEDURE [dbo].[iSRPDb_Sp_Search_WO]
@pBusinessUnitID as int=0,
@pProjectID as int,
@pSubcontractorID as int,
@pWONumber as varchar(10),
@PageSize as int
AS
BEGIN
SET NOCOUNT ON;
DECLARE @BusinessUnitFilter Varchar(255)
DECLARE @NameFilter Varchar(255)
DECLARE @SubConNameFilter Varchar(255)
DECLARE @WONumFilter Varchar(255)
DECLARE @Filter Varchar(2000)
DECLARE @StatusFilter VARCHAR(255)
DECLARE @PageNumber int
DECLARE @RowStart int
DECLARE @RowEnd int
DECLARE @condition varchar(255)
SET @StatusFilter=''
--if @PageNumber > 0
--
-- SET @PageNumber = @PageNumber -1
-- SET @RowStart = @PageSize * @PageNumber + 1;
-- SET @RowEnd = @RowStart + @PageSize - 1 ;
IF @pBusinessUnitID > 0
SET @BusinessUnitFilter = 'TWO. BusinessUnitID=' + Convert(Varchar(10),@pBusinessUnitID)
ELSE
SET @BusinessUnitFilter = ''
IF LTRIM(RTRIM(@pProjectID)) > 0
SET @NameFilter = ' AND TP.ProjectID =' + Convert(Varchar(255),@pProjectID)
ELSE
SET @NameFilter = ''
IF LTRIM(RTRIM(@pSubcontractorID)) > 0
SET @SubConNameFilter = ' AND TS.SubcontractorID =' + Convert(Varchar(255),@pSubcontractorID)
ELSE
SET @SubConNameFilter = ''
If ltrim(rtrim(@pWONumber))<> ''
Set @WONumFilter = 'AND TWO.WONumber LIKE ''%' + @pWONumber + '%'''
Else
Set @WONumFilter = ''
SET @FILTER =@StatusFilter + @BusinessUnitFilter + @NameFilter + @SubConNameFilter + @WONumFilter
exec('select
TWO.WONumber,
TS.Name AS SubcontractorName,
TP.ProjectCode,
TP.Description as ProjectName ,
TP.StartDate,
TP.EndDate,
ROW_NUMBER() OVER(order by TP.Description) as RowNO
from tblWorkOrderHeader TWO inner join
tblWorkOrderDetail TWOD on TWO.WONumber= TWOD.WONumber
inner join tblSubContractor TS on TWO.SubContractorID= TS.SubContractorID
inner join tblProject TP on TWO.ProjectID=TP.ProjectID
where ' + @FILTER)
end
--select * from tblProject where ProjectID=20101
--select * from tblSubContractor where SubContractorID=110244
--where (@subconid = 0 or @subconid = aa.subcontractorid)
|
|
|
|
|
Don't cross post. You picked the correct forum in the Database forum; leave it there.
|
|
|
|
|
Dear Sir i have to a problem to my project .
it has i wnat to recover to password code by using in project & How Retrive Data In gridview
|
|
|
|
|
Huh?
|
|
|
|
|
I have an MFC desktop app that implements the "Always On Top" feature by calling:
bool bOnTop = ...
CWnd* pWndOnTop = (CWnd *) (bOnTop ? &CWnd::wndTopMost : &CWnd::wndNoTopMost);
SetWindowPos (pWndOnTop, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
This works as expected. Regardless of whether or not the app is always on top of other windows, all child dialogs (both modal and modeless) are shown on top of the app's main window.
A Windows Forms version of the app attempts to do the same thing by P/Invoking SetWindowPos() . Although the app's main window responds as expected, all modal child Form s (both modal and modeless) fail to appear on top of the app's main window, and are instead occluded by the topmost main Form . I tried setting Form.TopMost and Form.TopLevel instead of calling SetWindowPos() but am still unable to display the modal child Form s on top of the main Form .
I've Googled far and wide and have browsed both SO and MSDN to no avail. A nudge in the right direction would be appreciated. I'd hate to have to nix this feature because of a problem with .NET. (I'm sure it's me and not .NET, but I'm at my wit's end.)
Thanks for any pointers you can send my way.
/ravi
modified 13-Apr-12 1:19am.
|
|
|
|
|
An owned form always appears in front of it's owner and if this is the desired behaviour just ensure that the popup forms are shown using the Show/ShowDialog methods with the IWin32Window owner parameter.
Interestingly the difference between ShowDialog() and ShowDialog(IWin32Window owner) do not become apparent until the calling form is made TopMost. At which point the problems you describe suddenly appear!
Alan.
|
|
|
|
|
Alan N wrote: Interestingly the difference between ShowDialog() and ShowDialog(IWin32Window owner) do not become apparent until the calling form is made TopMost. At which point the problems you describe suddenly appear! GAAAH! I'm a moron. Thank you, Alan for pointing that out!
/ravi
|
|
|
|
|
I have an interface with a client that is been in production for many years, and I would like to alter the xml parsing system that handles this message.
Since I may have 4 different StatusTypes I desire to have an array of the these items, however, they are not in a nice collection element that will make deserlization simple, like all of the examples on the internet that I could find.
In the code below, I was hoping to get all of these items in MysticalList. Obviously, my example does not work ... How can I get my entity to work with a simple list?
<xsd:complexType name="requestRailStatus">
<xsd:sequence>
<xsd:element name="TrainID" type="xsd:string" minOccurs="0" maxOccurs="1" />
<xsd:element name="BeginTimePeriod" type="xsd:dateTime" minOccurs="0" maxOccurs="1" />
<xsd:element name="EndTimePeriod" type="xsd:dateTime" minOccurs="0" maxOccurs="1" />
<xsd:element name="StatusType" type="railStatusOptions" minOccurs="0" maxOccurs="4" />
</xsd:sequence>
<xsd:attribute name="timestamp" type="xsd:dateTime" use="required" />
<xsd:attribute name="messageId" type="xsd:unsignedInt" use="required" />
</xsd:complexType>
<xsd:simpleType name="railStatusOptions">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="ActualTimeOfArrival" />
<xsd:enumeration value="ActualTimeOfWorking" />
<xsd:enumeration value="ActualTimeOfCompletion" />
<xsd:enumeration value="ActualTimeOfDeparture" />
</xsd:restriction>
</xsd:simpleType>
public partial class requestRailStatus : EntityBase
{
public string TrainID { get; set; }
public System.DateTime BeginTimePeriod { get; set; }
public System.DateTime EndTimePeriod { get; set; }
[XmlElement("timestamp")]
public System.DateTime TimeStamp { get; set; }
[XmlElement("messageId")]
public uint MessageId { get; set; }
[XmlArray]
public List<railStatusOptions> MysticalList { get; set; }
public requestRailStatus() { }
}
You can only be young once. But you can always be immature.
- Dave Barry
|
|
|
|
|
You called the property StatusType, not MysticalList, in the XSD. Also, I think you mean [XmlAttribute] not [XmlElement].
|
|
|
|
|
If I had only "StatusType" I would agree with you, however I have 4, I want all 4 of them to be placed in the single array...
You can only be young once. But you can always be immature.
- Dave Barry
|
|
|
|
|
Hello CodeProject. I'm having problems using this codeproject: http://www.codeproject.com/Articles/10162/Creating-EAN-13-Barcodes-with-C
Now it draws fine when I don't use this code in my Form1.cs
protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
cp.ExStyle |= 0x02000000;
return cp;
}
}
BUT I need the above code because it prevents all my controls from flickering easily. For some reason tho while using that code, the EAN13 barcode won't Draw to the pictureBox at all
Is there a way to edit that EAN13 barcode code to make it able to work while using the CreateParams code up above?
I need the barcode code working but I also can't let my huge application to flicker.
Please help CodeProject I would be so thankful
|
|
|
|
|
The usual way to get help on a CodeProject article is via the forum at the bottom of the article. However, if you get no response from the author then it is likely you will have to work it out for yourself.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Hi all! I've been reading an excelent book on C# called Illustrated C# 2010 and I feel like I this book covers a lot of the topics I need in order to learn how to program. However, it isn't a textbook so there are no exercises for me to practice what I'm reading. While I may retain some of what I'm reading, I find it imperative that I actually sit down and write code in order to learn it. So my problem here is a lack of exercises.
Can anyone suggest a website, or a book that has a suffient amount of exercises that will help me learn the material I am reading? I've checked out sites like projectelure and spoj, but those sites seem like they are geared for people that understand the syntax of programming languages already and just need to learn how to create algorithms. What I'm looking for is a resource that has exercises on how to apply what I've read (for example: Write a program that uses delegates to do this... or Write a program that uses Interfaces to do x...)?
Does this make sense to you guys? I feel like I just wrote a lot of stuff to ask what everyone else will think is a simple question.
|
|
|
|
|
I think the best way to learn is to develop an app. Pick something that intersts you and start writing it.
Then, build in what you've learned, and as you run into problems along the way, or if you want best practices, come back here.
Everything makes sense in someone's mind
|
|
|
|
|
Programming doesn't really lend itself to exercises.
1.1 Write a program to read a serial port carrying ASCII data and print the data in two columns.
Hmmm... How would anyone score the widely varying results in a classroom, let alone a book? When it comes to defining software solutions, there are just too many degrees of freedom. A classroom instructor can assign such problems, then take the time to work through all the individual solutions - one for each student - to find which work and which don't. A textbook author can't do that. Instead, they usually (the better ones, at least) provide lots of real world examples to demonstrate the concepts and how they apply to different challenges.
I'd suggest that you grab a good book with lots of sample code, then as you go through the material, set yourself a challenge to write code that does what the chapter is about. Then compare your solution to the worked out examples given by the author(s). The comparison will teach you a lot. One book I found tonight, which I just ordered for myself, by the way, is from Wrox Press. I've owned a number of Wrox books, and never found one that wasn't excellent. You can view it here[^].
Wrox books generally are very well written, easy to understand, and give you access to loads of downloadable code to study and try out.
Will Rogers never met me.
|
|
|
|
|
Thanks for the suggestion. I just ordered that book.
|
|
|
|
|
Just an update... got my copy Monday, skimmed over it, and it looks excellent. It covers a lot of topics that previous books I've used didn't, some basic things I didn't know, and I learned a few new things in the first 50 pages. But it's got to go back on the pile for a few weeks, at least until I finish this Statistics course... darn.
Will Rogers never met me.
|
|
|
|
|
Yeah I got mine Monday also. I've read about the first 100 or so pages and done all the exercises. Haven't learned anything new so far, but I'm reading it in conjunction with PRO C# and .NET 2010 which is explaining a whole lot of things I never even new existed.
|
|
|
|
|
|
LINQPad is great. I use it all the time for testing small snippets, one-time mini-programs, and just playing around to figure out how to use a .NET feature. The Dump() method is particularly useful for getting a feel for the structure of an object you're not familiar with.
The shout of progress is not "Eureka!" it's "Strange... that's not what i expected". - peterchen
|
|
|
|