|
Thanks for the fast reply , I didn't think anyone would post until the next day, but I was definately wrong. Also thanks for the info because I finally got it figured out.
|
|
|
|
|
I'm trying to implement the code found here:
http://www.codeproject.com/cs/files/recursivefileexplorer.asp
but I've hit a bit of a wall. I've got the following code in my project:
FileExplorer fe = new FileExplorer("C:\\boo");
FileData FileData = (FileData)fe.FileList[0];
but I keep getting the error: "...fe denotes a class where a field is expected"
I'm sure I'm not doing everything correctly, could someone give me a hand with this one?
Thanks in advance,
-Sean
|
|
|
|
|
It appears as you have used the name "fe" for a class in your project also.
---
b { font-weight: normal; }
|
|
|
|
|
Hi,
I am trying to start my email app (in this case Eudora) with a programatically generated email. However, Eudora does not seem to recognize any of the ways I have tried to create line breaks.
I have tried "\n", "\r\n", and using the StringBuilder AppendLine() method like this:
StringBuilder body = new StringBuilder(1024);
// AppendLine doesn't work
body.AppendLine("Thank you for registering!");
// Neither does this
body.Append(System.Environment.NewLine);
body.Append("Support Forums");
body.AppendLine();
body.Append("Please be sure that you have the latest version, ");
Process process = new Process();
process.StartInfo.FileName = "mailto:";
process.StartInfo.FileName += tbEmail.Text;
process.StartInfo.FileName += "?subject=GaugeGlow License Key";
process.StartInfo.FileName += "&bcc=benchmark-avionics@comcast.net";
process.StartInfo.FileName += "&body=";
process.StartInfo.FileName += body;
process.Start();
yet, when the email opens in the application, there are no line breaks at all.
Thanks,
Stick
|
|
|
|
|
I have a program that if it encounters an error, it asks the user for a new value from a new form. How can I pause execution so that when the User presses the button on the new form it continues execution on the original form?
|
|
|
|
|
Use the ShowDialog method to show the form.
---
b { font-weight: normal; }
|
|
|
|
|
numbers1thru9 wrote: How can I pause execution so that when the User presses the button on the new form it continues execution on the original form?
Pop up a modal dialog.
Best,
Jun
|
|
|
|
|
hello!
i'm wondering how can I populate a dataset with an arraylist??
I don't know if is so easy or crazy that no one writes about it...
it's driving me craazzyy...
|
|
|
|
|
Hi,
Try using this code. It works fine. Take it as an example. You can change to fit your needs.
ArrayList lst = new ArrayList();
lst.Add(1);
lst.Add(2);
lst.Add(3);
lst.Add(4);
lst.Add(5);
DataSet ds = new DataSet();
DataTable dt = new DataTable();
dt.Columns.Add();
dt.Columns.Add();
dt.Columns.Add();
dt.Columns.Add();
dt.Columns.Add();
ds.Tables.Add(dt);
ds.Tables[0].Rows.Add(lst.ToArray());
string items = "";
for (int i = 0 ; i < ds.Tables[0].Columns.Count ; i++)
{
items += ds.Tables[0].Rows[0][i].ToString();
}
MessageBox.Show(items);
Do your best to be the best
|
|
|
|
|
thanxs!!
I will try that code...
|
|
|
|
|
Hi All,
As given below I have an XML string and an arraylist which gives the correct sequence of the XML tags that is required.
<APL_OMNI_CLAIMS>
<SEQNO>Seq1</SEQNO>
<B_CO_CD>N</B_CO_CD>
<B_AREA_CD>Z</B_AREA_CD>
</APL_OMNI_CLAIMS>
My first task is to reorder the XML string as per the required tag order and then create a datatable so that we can bind it to a gridview to show data in following format
SEQNO Seq1
B_CO_CD N
B_AREA_CD Z
How do I do this stuff ??
Pls guide me, if any1 has some fundoostic idea on this.
Thanks
Omkar
|
|
|
|
|
Hi,
Omkar Ghaisas wrote: My first task is to reorder the XML string as per the required tag order and then create a datatable so that we can bind it to a gridview to show data in following format
Do you want an algorithm to reoder the XML string also?
I've just posted a way to insert an array list into a dataset's table. So you can create an array list with the items you want and then insert the array list into a dataset (or datatable). I'll post the code again.
ArrayList lst = new ArrayList();
lst.Add(1);
lst.Add(2);
lst.Add(3);
lst.Add(4);
lst.Add(5);
DataSet ds = new DataSet();
DataTable dt = new DataTable();
dt.Columns.Add();
dt.Columns.Add();
dt.Columns.Add();
dt.Columns.Add();
dt.Columns.Add();
ds.Tables.Add(dt);
ds.Tables[0].Rows.Add(lst.ToArray());
string items = "";
for (int i = 0 ; i < ds.Tables[0].Columns.Count ; i++)
{
items += ds.Tables[0].Rows[0][i].ToString();
}
MessageBox.Show(items);
Do your best to be the best
|
|
|
|
|
how to convert Bitmap to Icon
Palestine
|
|
|
|
|
Hello
It depends. If you want to do that using an external editor, there are tons of free icon editors. My favourite is MicroAngelo. Just google for "Fre Icon Editor" and you should find satisfying results.
If you want to it in your code -would be strange though-, this may take some workaround.
Regards
|
|
|
|
|
Nader Elshehabi wrote: this may take some workaround.
It's actually pretty simple. See my reply below.
|
|
|
|
|
Bitmap myBitmap = ...;
IntPtr bitmapIconHandle = myBitmap.GetHIcon();
Icon myIcon = Icon.FromHandle(bitmapIconHandle);
|
|
|
|
|
Hello
Nice catch. Got my 5.
The workaround I was thinking of is the dimensions. You wouldn't know in what dimensions the bitmap would be. I didn't know that GetHicon() would take care of that too.
Regards
|
|
|
|
|
|
Judah Himango wrote: IntPtr bitmapIconHandle = myBitmap.GetHIcon();Icon myIcon = Icon.FromHandle(bitmapIconHandle);
I did that exactly in my program and when I tried to use the file created for a icon in (VS2008) it gave me an error that the file needs to be a picture that can be used as a icon
I also tryed making the icon file manualy.
MemoryStream IconPic = new MemoryStream();
IconPic.Write(Convert.ToInt16(0));
IconPic.Write(Convert.ToInt16(1));
IconPic.Write(Convert.ToInt16(1));
IconPic.Write(Convert.ToByte(0));
IconPic.Write(Convert.ToByte(0));
IconPic.Write(0);
IconPic.Write(0);
IconPic.Write(Convert.ToInt16(0));
IconPic.Write(Convert.ToInt16(0));
IconPic.Write(Convert.ToInt32(WorkingImageInPNG.Length));
IconPic.Write(Convert.ToInt32(20));
IconPic.Write(""Bitmap converted to PNG"")
see http://en.wikipedia.org/wiki/ICO_(icon_image_file_format)[^] for the instructions that I followed.
Please help.
|
|
|
|
|
I want to know how to import an Excel file using ODBC connection
|
|
|
|
|
I am trying to devise a system for centrally handling events generated by controls in my application and passing these events to other controls who may be interested in them.
For example say I have an application where a control can add an employee to the system. The control does the necessary and then raises an event which is then passed to two other controls who may have to process this event.
I would like to define the event in one place and for the controls who want notification of the event to simply register this fact and then receive the events.
This is what I have so far but perhaps there is a better way, or maybe there is a nice design pattern which someone can point me to.
I have a common class called EventHandlerCommon which defines the EventArgs for the event and defines a public delegate: public delegate void EmployeeAddedEventHandler(object sender, EmployeeAddedEventArgs e)
The class then has a static method:
public static void RegisterEmployeeAddedEventHandler(EmployeeAddedEventHandler sourceMethod)
which adds the the delegate to an array of methods to call.
This class also has another static method:
public static void ProcessEmployeeAddedEvent(object sender, EmployeeAddedEventArgs e)
which can be called when the event is raised and will pass it to all the delegates in the array.
My main application has two user controls. Each has a constructor which registers their interest in the employee added event by creating a delegate and passing it to the static class described above:
EmployeeAddedEventHandler del = new EmployeeAddedEventHandler(MyLocalEmployeeAddedEventHandler); <br />
MyEventHandler.RegisterEmployeeAddedEventHandler(del);
The first user control actually generates the event so has:
public event EmployeeAddedEventHandler EmployeeAdded;
and raises this event when a button is pressed.
The main form for the application has an event handler to handle this event:
this.userControl1.EmployeeAdded += new EventHandlerCommon.EmployeeAddedEventHandler(this.userControl1_EmployeeAdded);
This calls the static method to pass this event to all the controls interested:
private void userControl11_EmployeeAdded(object sender, EmployeeAddedEventArgs e) <br />
{ <br />
MyEventHandler.ProcessEmployeeAddedEvent(sender, e); <br />
}
This seems to work ok. Each of the user controls registers their interest in the event and is passed the event when it is raised. Perhaps this is not the best way though. My concern is the connection between the main form of the application and its link to userControl1. What if userControl1 was programatically created during run time, how would the main form know it could raise an the employee added event.
Any advice in this area would be gratefully appreciated.
|
|
|
|
|
For event/notification handling, there are .NET event model and Observer/Subject design pattern. How is yours different than these two?
Best,
Jun
|
|
|
|
|
I am effectively using the .NET event model. My question seems to be how to handle controls that are programatically created. Say the main hub of my application deals with the events that controls can generate and passes these to the other controls to process.
If the main hub programatically creates a user control, how does it know what events this can fire and hook up an event handler to these?
|
|
|
|
|
GazzaJ wrote: controls can generate and passes these to the other controls to process
Hope this link can help.
GazzaJ wrote: If the main hub programatically creates a user control, how does it know what events this can fire and hook up an event handler to these?
I believe that you need to raise and consume events in your custom control. This link might be able to help.
Best,
Jun
|
|
|
|
|
Take a look at the smart client software factory (Google it, the first search page should contain various resources regarding this).
No need to reinvent the wheel.
|
|
|
|