|
ya thats true but that is not giving me the desired result, we need to fetch other results also prior to this(need to follow the sequence of result sets returned from the sp)..if my result is last one in the SP.....
|
|
|
|
|
sounds like you have to seperate your mega SP into smaller SPs to me then, still cant see why this is a prob without some code
|
|
|
|
|
actually i cannot change my sp ,bcos this is used in many other places of code they fetch
particular resultset which i require....
so please let me knoiw is there a way to fetch only the resultset i need from sp using Imultiplerersults.....
As this is achievable in classic ado.net using tablemappings where we can fetch the desired resultset from SP.
please let me know how this can be achieved in Linq to SQL....
|
|
|
|
|
Hi
I have trouble understanding the code that is on this page
http://www.sanity-free.org/13/numeric_text_box_number_only_text_box_control_in_csharp.html.
In PreProcessMessage I don't understand what the inparameter Message msg property WParam holds or Msg holds. When to use them and for what? I have also heard about the property LParam and HWnd, when should I use them. In WndProc we have
the code m.Result = (IntPtr)0. What holds the inparameter Message m's property Result and what is IntPtr? I have seen codes like
protected override void WndProc(ref System.Windows.Forms.Message m)
{
switch (m.Msg)
{
case WM_GETTEXT:
string s = ModifyOriginalText(this.Text);
int charsToCopy = Math.Min(m.WParam.ToInt32(),s.Length);
m.LParam = Marshal.StringToHGlobalAuto(s.Substring(0,
charsToCopy));
m.Result = new IntPtr(charsToCopy);
return;
}
base.WndProc(ref m);
}
Here they are using the property LParam and here they make a new IntPtr with another amount on int.
I need an accurate explanation when to use Msg, LParam, WParam, Result and for what.
And when we are calling
base.WndProc (ref m);
we want something to happen or what? I mean in the NumericBox example, when it finds not a number it just returns, but why does it have to add (IntPtr)0 to m.Result before. Could they instead have written new IntPtr(0)?
What does the amount to IntPtr tell us?
I know there are many questions, but I so much want to learn this and understand it thoroughly.
Hope you can help me and explain accurate.
Many thanks
Fia
|
|
|
|
|
The author is using the this to override the default Windows message handling process which is what drives a Windows program. In this case he checks to see if the message is WM_GETTEXT and if so returns his modified text to the calling process. This is not generally required in .NET applications but if you are really interested you can take a look here[^] on MSDN.
|
|
|
|
|
Hi
Thanks for the answer. But it doesn't tell me what the Message's properties Msg, LParam, WParam and Result are for. When to use them and what to do with them. And the question what to assign to m.Result, how do I know what to assign? I have seen so many examples when I have googled, but no explanation. I have seen m.Result = new IntPtr(charsToCopy)and m.Result= (IntPtr)0 or new IntPtr(0), but how do I know what integer to assign m.Result what does it differ.
Many thanks
Fia
|
|
|
|
|
The values of WPARAM , LPARAM and the return are all dependent on the message being processed. For example here[^] are the details for the WM_GETTEXT message.
|
|
|
|
|
Hi
Thanks again for your answers, but I have till trouble to understand to use m.Result=IntPtr(0) or what to put in IntPtr.
I have two examples I have googled:
In this example it stops users to paste anything to a textbox.
protected override void WndProc(ref Message m)
{
if (m.Msg != WM_PASTE )
{
base.WndProc(ref m);
}
}
In this example users can just paste in numbers in a textbox.
protected override void WndProc(ref Message m)
{
if (m.Msg == WM_PASTE )
{
IDataObject obj = Clipboard.GetDataObject();
string input = (string)obj.GetData(typeof(string));
foreach (char c in input)
{
if (!char.IsDigit(c))
{
m.Result = (IntPtr)0;
return;
}
}
}
base.WndProc(ref m);
}
Why do we have to assign to m.Result the InPtr 0? What is IntPtr and how do I know which int (amount) I should return?
Many thanks
Fia
|
|
|
|
|
As I explained in my previous answer you need to look at the documentation for each message to know what values are represented by the WPARAM and LPARAM input parameters, and what values may be returned if you process the message. For example the documentation for WM_PASTE is here[^]. You also need to read about the default WndProc() method in .NET here[^].
The use of IntPtr in C# is merely a type that corresponds to the 32 bit DWORD in C++, which is the normal return value from these functions.
|
|
|
|
|
If your goal here is to understand P/Invoke and 'WndProc,' and the use of parameters to P/Invokes ... then great, but, if your goal is to make progress in .NET and WinForms or WPF, then there are other techniques you can use to create an input field that only accepts numeric input that do not require getting 'outside the .NET box.'
Check out 'MaskedTextBox' and 'NumericUpDown' in WinForms, for example.
best, Bill
"Beauty is in the eye of the beholder, and it may be necessary from time to time to give a stupid or misinformed beholder a black eye." Miss Piggy"
|
|
|
|
|
Hi,
I work with WPF, and I have got a problem with binding a listbox.
The question is as follows.
I have a left list box of ten list box items. On the right hand I have a border where I can exchange between 10 User Controls.
So, I have a 10 listbox items for ten usercontrols. The problem is how to bind these 10 listitems and make them as a menu, so when I click on one of them I get the right User Control on the right side..
If ther is any solution, send please!
|
|
|
|
|
Article that may help[^]
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
CCC Link[ ^]
Trolls[ ^]
|
|
|
|
|
Bind the ListView's SelectedIndex property to something in the view model. Then bind some property of the border which controls which user control is visible to SelectedIndex, or if there's no property that you can bind which does the job, bind the Visible properties of the user controls to SelectedIndex with a binding converter int->bool which checks to see if it's the right one.
|
|
|
|
|
Help. I've spent way too much time on this. I've scoured the web for ways to set the focus on a cell in my grid and I'm using:
dataGridView1.CurrentCell = dataGridView1[e.RowIndex, e.ColumnIndex]; and it doesn't seem to work. I've found (and tried) more cumbersome ways to do it but I always prefer the simple approach. Could it have something to do with the fact that I call the function from the OnCellValidated method after I've tabbed out of the cell with bad data? Any illumination would be appreciated. thank you.
|
|
|
|
|
Tom Paronis wrote: dataGridView1.CurrentCell = dataGridView1[e.RowIndex, e.ColumnIndex]; and it doesn't seem to work. I've found (and tried) more cumbersome ways to do it but I always prefer the simple approach. Could it have something to do with the fact that I call the function from the OnCellValidated method after I've tabbed out of the cell with bad data?
That's very likely; can you post the content of the event here, in PRE tags, and tell us what you're trying to achieve?
You shouldn't be doing any validation in there; that should be done in the OnCellValidating event. That provides a way to "cancel" the action (see it's eventargs) and have the user not move to the next cell. To which cell do you want the user to go when he's trying to tab out of a non-valid entry?
Bastard Programmer from Hell
|
|
|
|
|
That sounds eminently logical and I will try it first thing tomorrow; it's Miller Time now. FYI, I'm a C++ programmer transitioning to C#/.NET and I try to do everything the C++ way; doesn't always work. Also, I like the handle. Cheers.
|
|
|
|
|
dataGridView500.Rows[rowIndex].Cells[colIndex].Selected = true;
is a candidate.
Warning: I'm not sure this also deselects any previously selected cells/row/columns.
|
|
|
|
|
It doesn't. dataGridView.CurrentCell is what is supposed to do this, I think, but it interacts with validation in an unhelpful way.
|
|
|
|
|
hello;
I have a 3dsmax model. and I want to move this model using kinect. how can ı connect 3ds max file to c#
I will wait your help.
thank you for your help already.
|
|
|
|
|
That's way too much to answer in a single post. You're asking the layout of a complete (commercial!) project? Expecting that anyone 'ere would simply post it?
You could start with downloading the Coding4Fun Kinect Toolkit[^] and studying it.
Bastard Programmer from Hell
|
|
|
|
|
I have written an Outlook 2007 Add-In using Visual Studio 2010 and C# (.NET 4.0). All is well most of the time but I encounter a crash in Outlook once in a while. When the crash occurs it is ONLY when Outlook is disconnected from the Microsoft Exchange server. My work laptop connects wirelessly and my job requires that I connect to two different local wireless networks, depending on the task(s) which I must complete. While on the primary network, Outlook is connected to my employer's MS Exchange server. On the other network, it disconnects (goes into Offline mode). Every once in a while, when disconnecting from the primary network, Outlook crashes, though not every time.
Below is the only code which is executed by the add-in. It runs periodically (every ten minutes).
private void CheckFolderItemsMU(Outlook.Folder folder)
{
if (folder.Folders.Count > 0)
{
foreach (Outlook.Folder f in folder.Folders)
CheckFolderItemsMU(f);
}
if (folder.DefaultItemType != Outlook.OlItemType.olMailItem) return;
if (folder.Name == "Deleted Items" || folder.Name == "Sent Items" || folder.Name == "Outbox") return;
if (folder.Parent.Name != "*COMPANYNAME*") return;
Outlook.Items items = folder.Items;
Outlook.MailItem mailItem = null;
foreach (object collectionItem in items)
{
mailItem = collectionItem as Outlook.MailItem;
if (mailItem != null)
{
string subject = mailItem.Subject.ToUpper();
subject = subject.Replace("FW: ", "");
subject = subject.Replace("FWD: ", "");
subject = subject.Replace("RE: ", "");
if (mailItem.SenderName == "*NAMEOMITTED*")
{
if (string.IsNullOrEmpty(mailItem.Categories))
mailItem.Categories = "*NAMEOMITTED*";
}
else if (mailItem.SenderName == "*NAMEOMITTED*")
{
if (string.IsNullOrEmpty(mailItem.Categories))
mailItem.Categories = "LPS Data";
}
else
continue;
if (mailItem.IsMarkedAsTask) continue;
if (mailItem.Importance != Outlook.OlImportance.olImportanceHigh)
mailItem.Importance = Outlook.OlImportance.olImportanceHigh;
mailItem.MarkAsTask(Outlook.OlMarkInterval.olMarkToday);
mailItem.TaskStartDate = DateTime.Now;
mailItem.TaskDueDate = DateTime.Now.AddHours(1);
if ((DateTime.Now.Hour > 14) && (DateTime.Now.Minute > 45))
{
DateTime dateDue = DateTime.Now.AddDays(1);
if (dateDue.DayOfWeek == DayOfWeek.Saturday) dateDue = dateDue.AddDays(2);
else if (dateDue.DayOfWeek == DayOfWeek.Sunday) dateDue = dateDue.AddDays(1);
dateDue = new DateTime(dateDue.Year, dateDue.Month, dateDue.Day, 7, 0, 0);
mailItem.TaskDueDate = dateDue;
}
else
mailItem.TaskDueDate = DateTime.Now.AddMinutes(20);
mailItem.Save();
}
}
}
Is there anything here which appears to be a problem while Outlook is in Offline Mode?
djj55: Nice but may have a permission problem
Pete O'Hanlon: He has my permission to run it.
|
|
|
|
|
Matt U. wrote: Is there anything here which appears to be a problem while Outlook is in Offline Mode?
How about catching the exception and logging it? Might give a nice hint on why it's crashing.
Bastard Programmer from Hell
|
|
|
|
|
Oh my. That was a complete fail. I have no idea why I did not do that to begin with. I figured it out. It was the line "if (folder.Folders.Count > 0)".
djj55: Nice but may have a permission problem
Pete O'Hanlon: He has my permission to run it.
|
|
|
|
|
Matt U. wrote: I have no idea why I did not do that to begin with.
Happens when you're busy, working people tend to make mistakes from time to time. Good to hear that you already fixed it
Bastard Programmer from Hell
|
|
|
|
|
Hi Guys,
I need to be able to format the text displayed by a CheckBox or RadioButton to show specific words within the text as bold, underline and/or italic. HTML would make this easy but I haven't been able to find any controls of this type that offer anything other than plain text properties.
Could anyone offer suggestions to solve this problem? I'm open to commercial component libraries (if they come with source) or to writing a custom component. If my only option is a custom component, a suggestion of an article/tutorial on the OnPaint method would be great.
Thanks...
|
|
|
|