|
I suggest asking Yahoo, its their error message. Have you tried just logging on and sending an email via the yahoo site to see if you get the same problem?
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
Hi,
I want to add more than one controls like lable, text box for a single cell to the datagridview control.
Thanks in Advance.
modified on Thursday, March 19, 2009 8:18 AM
|
|
|
|
|
Can you even add one?
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
I can add one control but i cant add more than one.
my requrement is to add more one control to the single cell and select each control
Tqs for the response
|
|
|
|
|
How do you add one control? As far as im aware the different controls you mention are just different styles of datagridview cells.
In which case the same question could be asked. how do i add 2 textboxes to 1 textbox? answer is you cant
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
its not to add 1 control to another control
add to cell those controls and select each control individually.
when you select single control, need to show some properties.
|
|
|
|
|
I know what you are trying to achieve, but my point is that controls cant be added to datagridview cells. Maybe i am mistaken, that why i ask how you can add one control?
Post come code showing how you have managed to add one control to a datagridview cell then maybe i can help you better with your needs
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Hi All,
I have very little experience with threading and have been building an object that creates a thread internally (not sure this is even a good design idea). Just as an example I have created this class (with a delegate):
public delegate void ThreadCompleterEventHandler(object sender, ThreadCompleteEventArgs args);
public class ObjectThatCreatesAThread
{
public event ThreadCompleterEventHandler ThreadCompleted;
private Thread t;
public ObservableCollection<string> StringsCollection;
public ObjectThatCreatesAThread()
{
StringsCollection = new ObservableCollection<string>();
}
public void PopulateStringsCollectionOnOtherThread()
{
t = new Thread(delegate()
{
DoWork();
});
t.Name = "Populate StringsCollection Thread";
t.Start();
}
private void DoWork()
{
StringsCollection.Add("String1");
StringsCollection.Add("String2");
StringsCollection.Add("String3");
OnThreadCompleted();
}
private void OnThreadCompleted()
{
ThreadCompleted(this, new ThreadCompleteEventArgs());
}
}
This object is created by a button click on a WPF UI. Like:
private void RunThread_Click(object sender, RoutedEventArgs e)
{
obj = new ObjectThatCreatesAThread();
obj.ThreadCompleted += new ThreadCompleterEventHandler(obj_ThreadCompleted);
obj.PopulateStringsCollectionOnOtherThread();
}
In the eventhandler in the UI I have:
void obj_ThreadCompleted(object sender, ThreadCompleteEventArgs args)
{
StringsListBox.ItemsSource = obj.StringsCollection;
}
Which throws a InvalidOperationException "The calling thread cannot access this object because a different thread owns it.". Which is easily rectified by doing this instead:
void obj_ThreadCompleted(object sender, ThreadCompleteEventArgs args)
{
Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(delegate()
{
StringsListBox.ItemsSource = obj.StringsCollection;
}));
}
My question is why does the DoWork() method running on the spawned thread gain ownership of the StringCollection object that was in fact constructed on the UI thread?
Is there any way to move this collection back to the ownership of the UI thread without the need for the Dispatcher.BeginInvoke()
Am I actually just trying to code around a bad practise?
I would prefer to make this object as user friendly as possible so that even though it is spawning a thread internally at the end of the threads execution the collection is made available to other threads to work with, I guess specifically the UI thread. Is there anything I can set at thread construction time to facilitate this?
Thanks,
|
|
|
|
|
Change the signature for the OnThreadCompleted method and try the following.. I have not tested the code:
private void OnThreadCompleted(object sender, ThreadCompleteEventArgs e)
{
System.ComponentModel.ISynchronizeInvoke sync;
if (ThreadCompleted != null)
{
foreach (Delegate d in this.ThreadCompleted.GetInvocationList())
{
sync = d as System.ComponentModel.ISynchronizeInvoke;
if (sync != null)
{
if (sync.InvokeRequired)
{
ThreadCompleterEventHandler del = new ThreadCompleterEventHandler(OnThreadCompleted);
object[] args ={ sender, e };
sync.BeginInvoke(del, args);
return;
}
}
this.ThreadCompleted(sender, e);
}
}
}
|
|
|
|
|
Wow ... thanks for this ...
I just tried this code and I'm getting a StackOverflowException on:
this.ThreadCompleted.GetInvocationList();
If I put a breakpoint on this line and look at the ThreadCompleted object the _invocationList has a count of 0 even though I know there is at least one subscription to the event ...
|
|
|
|
|
If you email me your solution, i can assist you further.
|
|
|
|
|
Thanks for this offer Fayu, where should I send the solution?
Thanks,
|
|
|
|
|
Check your email. I sent you my e-mail address.
|
|
|
|
|
I looked at your code and it seems like you are using WPF. This changes things. Multithreading is a little different in WPF. The code below should resolve your issue:
if (ThreadCompleted != null)
{
Window caller = (Window)this.ThreadCompleted.Target;
if (!caller.Dispatcher.CheckAccess())
{
ThreadCompleterEventHandler del = new ThreadCompleterEventHandler(OnThreadCompleted);
object[] args = { sender, e };
caller.Dispatcher.Invoke(del, args);
return;
}
this.ThreadCompleted(sender, e);
}
Hope this helps.
modified on Friday, March 20, 2009 8:53 AM
|
|
|
|
|
hello ,
i would like to use Rejex to validate a user name.
my user name rules are as follows:
1. first character is a letter : a-z, A-Z
2. other characters can be letters , numbers and _
3. a space can be used only once.
i tried this one but it didnt work :
Boolean Result = false;
string PatternString = @"[_-zA-Z0-9\s]$";
Result = Regex.Match(UserNameString, PatternString).Success;
tnx in advance,
avi
|
|
|
|
|
im not 100% but try...
"[a-zA-z][a-zA-z0-9_]*[ ]?[a-zA-Z0-9_]$"
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
hi,
its semi working.
there is a problem with the initial value.
i can enter the following string: ,jukj
and it will also be successfull.
tnx,
avi
|
|
|
|
|
oh yes, you need to make it specify to use the start of the string, i think ^ does that job...
"^[a-zA-z][a-zA-z0-9_]*[ ]?[a-zA-Z0-9_]$"
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
You also probably need another asterisk in there right before the $. Otherwise it'll only allow one more character after the optional space.
|
|
|
|
|
cool
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
thanks musefan , it works fine
|
|
|
|
|
shabya wrote: 1. first character is a letter : a-z, A-Z
2. other characters can be letters , numbers and _
3. a space can be used only once.
Based on that, I suggest a little modification to musefan's regex.
"^[a-zA-z][a-zA-z0-9_]*\s?[a-zA-Z0-9_]*$"
Eslam Afifi
|
|
|
|
|
kool , it works
here's an email "Rejexianization" i found , also works well
string PatternString =
@"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}" +
@"\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\" +
@".)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$";
|
|
|
|
|
Hi Everyone
I have a class which contains a load of data for my application which is to be saved using serialization. The problem is, I have a couple of hash tables in there which automatically impletents iDictionary. Serialization does not like this. Is there a way of making this work? or does anybody have any other ideas on what I could use to store value pairs of data that does not implement iDictionary?
Thank you
oooo, the Jedi's will feel this one....
|
|
|
|
|
do googling!!!!!!!
there is no direct way to do this but yes workaround is there and available on internet
|
|
|
|