Answer Questions
VickyP exportin to excel from datagrid in vs2003
Hello,everyone,i think my problem is a beginner,maybe many programmers have faced this: i have a datagrid ,it shows the data from sql server,and i want to export the all data to an excel file,and open a savefiledialog to ask you where to save to: now i have put a savefiledialog and have set the filter and the default path,how can i achieve this try this, using the COM Interop approach: http://www.codeproject.com/csharp/export.asp maybe have some namesapce first or can i get the excel from the datagrid that generate from dataview. you need to add a reference to the Excel COM library..... I am also still looking for another perhaps better soluti ...Show All
LastHope .Net 2.0 INotifyPropertyChanged Interface Implementation
Dear friends, In my current project I am using the CustomCollections with the help of BindingList<T> generic class to store the database records instead using DataSet objects as offline database identities. Now I do have a large number of property classes each having a large number of properties in it. I want to implement the INotifyPropertyChanged interface in every property class as follows: The purpose to implement the INotifyPropertyChanged interface is I want to inform the UI whenever any property change occurs and update the it accodingly. Also I need to inform the ListChanged event of the my BindingList<T> collection object using the PropertyChangedEvent of INotifyPropertyChanged interface. I know that the PropertyChange ...Show All
mosaic Accessing files over network
can somebody assist me how to access the files over the network in a web application using C#. I need to copy a certain file from server to local machine in a web application using C#, can somebody help me regarding this. thank you The System.IO.File class can be used to copy files using UNC as the pathname. So, assuming appropriate permissions, you should be able to do something like. System.IO.File.Copy(fromPath, toPath); where fromPath (and or toPath) is in the form of "\\MyServer\MyShare\filename" Hope that helps. thanks for the reply........what is given is ok but i want the namespace to access over the network. I tried what u specified but it is giving URI error. can u ...Show All
dczraptor Partial classes wreaking havoc on form that subscribes to another form's FormClosing event.
I have a form "A" that opens another form "B" with B.ShowDialog(). In form A I subscribed to the FormClosing event of B. Once I did that, I could not design view on form A. I got the following error in the design window where "srch" is the variable name for form B: The variable 'srch' is either undeclared or was never assigned. Hide Edit at System.ComponentModel.Design.Serializati on.CodeDom Serializer Base.Error (IDesigner Serializat ionManager manager, String exceptionText, String helpLink) at System.ComponentModel.Design.Serializati on.CodeDom Serializer Base.Deser ializeExpr ession(IDe signerSeri alizationM anager manager, String name, CodeExpression expression) at System.ComponentModel.Design.Serial ...Show All
JedG How i can zip files with SharpZipLib
Hello! i made file explorer that adds selected files to treeView3. i have spent alot time looking for samples of SharpLibZip, i want make my zip package contain filestructure.( example c:\folder1\folder2\somefile.ari, and saves those folders on zip). here is what i made up this far: try { string outputdir = @"C:\arska.zip"; ZipOutputStream ZipStream = new ZipOutputStream(File.Create(outputdir)); ZipStream.SetLevel(5); for (int i = 0; i < treeView3.Nodes.Count; i++) { TreeNode lastNode = treeView3.Nodes ; string file = treeView3.Nodes .Text; FileStream fs = File.OpenRead(file); byte[] buffer = new byte[fs.Length]; fs.Read(buffer, 0, buffer.Length); ZipEntry ent ...Show All
J. Clark Button Madness (one of many posts to come)
I know I should have been more descriptive in the subject, but the question is too long to fit. I'm trying to make a charicter creation application for a RPG. I want to have it so that when a person clicks the + button (button2), it will subtract one for the remaining points which is displayed in label20, add it to the Strength score (int Str) and then display the modified Strength in label11. Next, I have a subtract button (button10) that does the same but adds one to the remaining points and subtracts 1 from the Strength score (int Str) and displayes the remaining points and Strength in thier appropriate label boxes. To complicate matters worse, I have to 1: have to do this for 7 other stats, which none of them can go lower than ...Show All
Antarctica Passing arguments to a function started by a thread
I need to setup a thread to start a function that takes an int argument.. Any solution on how I can pass that argument Hey man ! Thanks a lot..the tips from the link u gave where realy helpfull. I'm currently working on a SCADA software aplication witch involves comunicating through serial ports an LAN with a variety of different protocols wich varry in speed and timeouts ..the threads realy do they job. There are a number of ways to do this, if it is as simple as just passing a parameter and not expecting a return value, then I would probably use the parametizedThreadStart method see http://www.yoda.arachsys.com/csharp/threads/parameters.shtml for how to do this. ...Show All
ZardoS42 trap "enter" key on button to send "tab" to next control instead of fired OnClick(...)
I have a window's form with many buttons, what I like to do is move arround all edit controls using "enter key" so every time you finish fill your data in an edit control hit enter and move to next control, I know how to do it usind SendKeys.Send( "{TAB}" ); But what about buttons, when I hit enter , button.onclick is executed. How can move to next control instead of OnClick(), but when you actually click with the mouse over this button you get OnClick as usual. Thanks in advance for your help and time. Edward Mac You need to create new button control inherited from Button control. Then you need to override ProcessDialogKey and do some changes like: protected override bool ...Show All
PDav How to load images effectively ?
Hi guys, In my program I want to view thumbnails.. But when the original image size goes up the program starts to freeze.. In my method I directly load the original image to an Image object and then using the GetThumbnail(....) method resize it and pass to another Image object. But it seems this is not an effective way !! Is there any idea, or trick or something else to increase this performance I am open to any advice.. Best regards Try this code. It needs more work but you can quickly check if your program is running faster. public static void LoadThumbnail(String path, PictureBox box) // Load image file <path> into picturebox <box> { Image image = Bitmap.FromFile(path); Bitmap thumb ...Show All
washaw64 convert object returned from Stored Proc to Guid
convert object returned from Stored Proc to Guid /// <summary> /// Insert method creates a new group record. Called from the Save method. /// </summary> /// <param name="group"></param> /// <returns>Method's success or failure.</returns> private static bool Insert(GroupInfo group) { group.GroupID == null; group.GroupID = (db.ExecuteScalar("syl_GroupInsert", group.GroupName, group.OwnerID, group.SecondaryContactID, group.DateAdded, group.FullURL, group.AvailableCredit, etc. We tried Converter<object, Guid> in place of the and it is not working! ! Replacing w ...Show All
Xiao Feng C# and Preprocessor macro
hello, i'm a newbie with C# and i'd like to Preprocessor macro like I do with my C compiler how can I do that is it possible example #define STEP1 0x01 #define STEP2 0x02 void Function(int Choice) { switch(Choice) { case STEP1 : break; case STEP2: break; } } Sadly no... the preprocessor support in C# does not support this kind of value replacement as is supported in C and C++, instead in C# its support is pretty much limited to conditional compilation ala: #define MySymbol int DoSomething() { #if MySymbol //Is included into build return 10; #else //Is NOT included into build return 20; #endif } ...Show All
Ljan how to Get all of SelectedValue and put it in On textbox?
"I've one checkboxlist in a webform, I was tried to retrieve all of SelectedValues from CheckBoxlist"; way 1 : string i = SelectBoxList.SelectedValue; Label1.Text =i; this way is only shows "1" Value in Textbox whatever how many CheckBox I Select. way 2 : (I Use Array) string [] checklist = (string) (CheckBoxList.SelectedValue); Label1.Text= checklist[0,1,2,3,4]; when run Theme way 2 , System throw Error message .... could someone help Me to Resolve this problem thank you very much ! One thing missing from your code is the .Items after chklist in your foreach. I didn't mess around with you ...Show All
David465465454 Generic Multi-Dimensional Arrays Comparison
Hi, I need to compare multi-dimensional arrays in a function which takes 2 multi-dim arrays which can be any type(int, double, bool...etc). Comparison is done by Object.Equals() of each value in each index of the arrays. As a result, Generic and Multi-Dimensional is what I need to combine. Any idea I compare 1 Dimensional-arrays with the below code of mine: public static bool AreArraysEqualByVal<T>( IList <T> src, IList <T> dest) { if (src == null || dest == null ) throw new ArgumentNullException ( "source or destination array is null." ); if (src.Count != dest.Count) { Debug .WriteLine( "Array lengths were not equal." ...Show All
Richard Kain Show no window
Is there a way to make a console or windows program not show a window I have a program that I am going to schedule that will get data every hour from a database and ftp this up as a file to a server, but I don't want the window to pop up everytime incase there is someone else doing work on this computer. Thanks in advance! To continue w/ GLM's post ...here is a recent article on Windows Services Working with Windows Services which might be a little more user friendly than MSDN. Nice this is exactly the information I needed. Thanks! If you don't want a UI you should consider creating a Windows Service instead. Here is a links that contains other links to articles ...Show All
Simone1 Intellisense for events...
Hi! I have a component that provides some events (via the Properties Window in VS2005) So, when when selecting some event I can show some breef text telling the user something about the event in the bottom of the Properties Window (via Attributes). But, I want to provide some help of the parameters in the generted event stub; private void myComponent_OnConnected(string ipAddress) { } How to provide some info/help about my parameter ipAddress I would like some text to show up when holding the mouse over the method name... Thanks, Mats Tanks! I have tried this, it doesn't give the user of my component any more help at designtime as far as a can see. The only thing that provides a little bit of help to the user, is if I instead of ...Show All
