|
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...
|
|
|
|
|
The standard button won't do this. If a quick search hasn't turned it up already, you may have to do it yourself. Custom painting a check box is a bit tricky because you still want the OS to draw the box for you, but not the label.
|
|
|
|
|
When you say "format" are you describing something going on at run-time where someone using your application can change the color, font, style, etc. on-the-fly ?
"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"
|
|
|
|
|
No. I will be creating the component at run-time, populating the text and positioning the component on a form. I'm creating a questionnaire with a varying # of multiple choice answers. Some of the available answers will have words that are bolded, etc.
Example:
Q: Are you here?
A : Yes Always
B : No Sometimes
C : Not Sure
|
|
|
|
|
Since you know the formatting of the questions in advance ... I'd consider:
1. possibly using a WebBrowser control
2. creating a UserControl (Luc beat me to it, as usual) that combines either an actual CheckBox, or a simulation of a CheckBox, with a RichTextControl.
3. doing some research here on CP (and StackOverFlow[^]) for WinForms controls that can render the subset of HTML you need (I do think there are some here on CP). And, naturally, Google[^].
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"
modified 28-Sep-11 10:53am.
|
|
|
|
|
As a standard CheckBox/RadioButton won't do that, you need something else, maybe an aggregation of two existing Controls. How about a RadioButton-without-text and something (a Panel, a RichTextBox, a WebBrowser) where you get the text any way you want it?
The drawback now is it's click area will not cover your text. A possible remedy is to have a RadioButton-with-text where ForeColor equals BackColor, effectively hiding its text. The other control then needs to be click-through, which probably simply means disabled. Another possibility is you execute a RadioButton.PerformClick inside the Click handler of your text displaying Control.
|
|
|
|
|
You could put one of these[^] labels next to the checkmark. Don't forget to hook up the keyhandler to toggle the checkbox when the label has focus and the user presses the space-bar.
Bastard Programmer from Hell
|
|
|
|
|
I am new to SIP and i have been the Lumisoft examples for SIP Call Out and SIP UA. I am having a big problem making a call. I can call another SIP client and the call will be received. However, my application does not recognize the response form the other end. For example, even if the call is picked from the other end, my application still keeps on ringing.
About the incoming call, from wireshark, i can see that the call is going through but the application does not seem to be noticing this. Has anyone used this API? Kindly help me know how i can listen on the incoming calls, especially that. And how can i ensure that the response is well received on my end to ensure that if someone accepts a call, i can actually initiate a dialog?
|
|
|
|
|
There are lot of client/ Server tcp chat program but they all are doing broadcasting.
I want a program where i can talk to a specific client-to-client.
I know there is
serverSocket.LocalEndPoint and
serverSocket.RemoteEndPoint which can be used.
Is there any good article or program which I can use as reference to develop this program
|
|
|
|
|
There are lots to be found through Google[^], but you may need to read through a few to get one that matches your exact needs.
|
|
|
|
|
nitin_ion wrote: I want a program where i can talk to a specific client-to-client.
There are some articles here in CP about chat applications that support private messaging, if that's what you mean. Take a look.
A Complete TCP Server/Client Communication and RMI Framework - Usage[^]
LanTalk[^]
Or you can choose what you need on the list of articles here[^]
Signature construction in progress. Sorry for the inconvenience.
|
|
|
|
|
The server needs to hold a map of client sockets to user names, and then when you request chat to a particular user, the server looks up the socket and sends a message only to that one.
My lobby server does this by using the socket ID number and storing user information including that ID. Joining a game, chatting within a game or PMing another user use the member IDs to route messages. But (i) that uses my socket library and (ii) does a lot more than just this, so it may not be a good example.
|
|
|
|
|
Since socket is internetwork and they all are connected to server with same port and IP.
When i try to send message to a particular client using RemoteEndPoint and IPAddress
var ip = new IPEndPoint(i, j) it still send messages to all clients.
Then how can i connect to a client?
|
|
|
|