|
No, but you can catch your application errors using try/catch blocks. In the catch block, you can display your own custom message with your own dialog if you wish.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Little House on the Flickr
Judah Himango
|
|
|
|
|
I want to convert a string str="ABC=100 BC C=50" to xml
as
<MyXML>
<ABC>
<value>100</value>
<operator>=</operator>
</ABC>
<BC>
<value></value>
<operator></operator>
</BC>
</MyXML>
Is it possible?
bidisha
|
|
|
|
|
if everything is going to be space delimited then it's definately possible.
string s = "abc=100 bc c=50 def=20"
string[] strings = s.Split(" ");
This will give you an array of xml elements split at each space " ". Then you've just gotta go through each one and work out whether or not it has an operator and create your xml file. Just make sure that the only spaces in the string are between elements, if you need spaces elsewhere then use a different character like a comma.
string s = "abc=100,bc,c=50,def=20"
string[] strings = s.Split(",");
Cheers
Kev
|
|
|
|
|
MatchCollection matches = Regex.Matches(str, @"(?<name>[^=\s]+)(=(?<value>\d+))?");
Use this regular expression. This will give you a match collection with the captures "name" and "value". It's easy to transform this into an XML then.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hello all
i want to know how to capture the icon of a file or folder , or at least create shortcut icon for it , and then use it in my application
thx all
|
|
|
|
|
|
Hello,
I'm trying to get all images out of the projects resource file dynamically. I tried it with the System.Resources.ResourceManager class but it will not work! Can someone help me please or does someone have another idea how to get this work properly?
Thx,
Thomas
|
|
|
|
|
Post your code, maybe it needs some modifications...
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
Hi,
thanks for your answer. I did some research and now have a simple but stupid solution:
ResourceManager rm = new ResourceManager("ImageLoader.Properties.Resources", System.Reflection.Assembly.GetExecutingAssembly());<br />
<br />
CultureInfo resourceCulture = new CultureInfo("de-AT");<br />
ResourceSet rs = rm.GetResourceSet(resourceCulture, true, true);<br />
<br />
IDictionaryEnumerator id = rs.GetEnumerator();<br />
<br />
ImageList il = new ImageList();<br />
<br />
while (id.MoveNext())<br />
il.Images.Add((Bitmap)id.Value);<br />
<br />
rs.Close();
|
|
|
|
|
I am trying to make a program that kan simulate a keypress on the keyboard. I've tried to use sendkeys and it seem to work fine as long as i stay in a nativ Windows environment.
So what i want to do is to be able to insert a key directly in the keyboard input stream so that i can simulate a keystroke without typing on the keyboard but instead activate it by some other means (like voice or mouseclick).
|
|
|
|
|
|
I am using a windows form datagrid and a datatable is used as the datasource.I want to prevent deletion of the first row.I tried with datatable's rowdeleting event.But i was not able to reject the changes.Can any one help.I'm pasting the code that i tried
Private Sub DataTable_RowDeleting(ByVal sender As System.Object, ByVal e As System.Data.DataRowChangeEventArgs)
If e.Action = DataRowAction.Delete Then
If dgGrid.CurrentCell.RowNumber = 0 Then
e.Row.RejectChanges()
CType(sender, DataTable).AcceptChanges()
End If
Else
e.Row.AcceptChanges()
End If
End Sub
Anup Balakrishnan
|
|
|
|
|
In order to solve the problem I had to ctreate my own DataGrid:
public class CustomDataGrid : System.Windows.Forms.DataGrid {
public CustomDataGrid() {}
public bool bAllowDeleteRows {
get { return m_bAllowDeleteRows; }
set { m_bAllowDeleteRows = value; }
}
public override bool PreProcessMessage(ref System.Windows.Forms.Message msg) {
Keys oKeyCode = (Keys)(msg.WParam.ToInt32() & (int)Keys.KeyCode);
if ((oKeyCode == Keys.Delete) & (msg.Msg == 0x100) & !m_bAllowDeleteRows){
MessageBox.Show ( "Rows deletion is not allowed" );
return true;
}
return base.PreProcessMessage (ref msg);
}
protected override bool ProcessDialogKey(Keys keyData) {
if (keyData == Keys.Delete && this.IsSelected ( this.CurrentRowIndex ) && !m_bAllowDeleteRows ){
MessageBox.Show ( "Rows deletion is not allowed" );
return true;
}
return base.ProcessDialogKey (keyData);
}
private bool m_bAllowDeleteRows = true;
Overitten functions prevent deleting row when a user click on delete.
|
|
|
|
|
Can you help me how this can be impleted in my project.This is very urgent for me.Waiting for response.
|
|
|
|
|
I didn't see your code but you need to do the following:
1) Create a new custom DataGrid using the code from the previous message
2) Change all instances of DataGrid in your code to a new CustomDataGrid
3) Set bAllowDeleteRows property of a CustomDataGrid to true
That's all you need to do...
|
|
|
|
|
... I receive this error :
"bla bla bla on Local Computer started and then stopped. Some services stop automatically if they have no work to do, for example, the Performance Logs and Alerts service."
It worked fine before I used some calls to JMail COM-object ...
I Removed the email-functionallity and then it started again.
Do I have a credentials-problem or what?
Please help!
//Maw
|
|
|
|
|
It seems that your email code throws an exception, effectively stopping your service just like an application crash.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi Dave ...
Got any suggestions? The JMail works when I use it in debug. I use a 3 projects to debug this service.
1. Coreclass (contains Functions for Start and Stop
2. Service (Only when doing a release. Use Core as reference. OnStart Calls Core.Start etv)
3. TestApp (My testappliacation. Use Core as reference. Has 2 buttons wich calls Core.Start and Core.Stop)
If I use TestApp then I have no problems. When I compile service I get all this problem.
Can I debug my service in any way? I write errors to Event-log but nothing gets there.
Thnaks // Maw
|
|
|
|
|
|
Did the forum "eat" your code or something? Becouse I really don't understand what you mean...
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
how to get items count OF an Enumaration?
-- modified at 8:34 Tuesday 17th January, 2006
|
|
|
|
|
|
It is clear.
Imagine an enumaration
Enum Crypt
ASD = 1
SDE = 3
DFR = 6
RTE = 9
TEL = 12
MGJ = 17
EIV = 23
... .
End Enum
I need items count of Enum
for example any property like Crypt.Count
if there is no way i will write my own class.
|
|
|
|
|
It's easy - use Enum class
<br />
public enum MyType<br />
{<br />
First,<br />
Second,<br />
Third,<br />
Fourth<br />
};<br />
<br />
Then you can retrive number of items in this way:
<br />
int numOfEnumItems = Enum.GetValues(typeof(MyType)).Length<br />
DevIntelligence.com - My blog for .Net Developers
-- modified at 8:26 Tuesday 17th January, 2006
|
|
|
|
|
Thank you for your help
|
|
|
|