536 Posted Topics
Re: Assuming that [I]eval [/I]will appear as text in the source string then you can use [iCODE]source.Contains("eval")[/iCODE] to test for "eval". Note: [I]Contains[/I] does a case sensative test. So if it [I]eval[/I] could be "Eval" then use [iCODE]source.LastIndexOf("eval", StringComparison.InvariantCultureIgnoreCase)[/iCODE] which will return -1 if not found. | |
Re: Try adding a test for the table count. [CODE]if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { dataGridView1.DataSource = ds.Tables[0]; }[/CODE] | |
Re: Firstly using the @ infront of a string will mean that the \\ is illegal. Secondly, AFAIK none of the .Net file handling classes support wildcard characters in filenames so the * is also illegal. Use Directory.GetFiles to get a String array of filenames. Then perform the move on each … | |
Re: Your [I]ZoomIn[/I] method only changes the size of the PictureBox, it does not changes its [I]Location[/I]. Therefore the top left corner of the PictureBox remains where it is and the right and bottom move by the change in size. You need to adjust the [I]Location[/I] property of the PictureBox (by … | |
Re: Alternativley, set the forms [I]AcceptButton [/I]property to the button you want to execute on Enter. Setting the forms [I]CancelButton [/I]property will do the same thing for Escape. And setting the forms [I]HelpButton [/I]captures the F1 key. | |
Re: Try these links. The first one has an example very similar to your code. [URL="http://www.minich.com/education/wyo/stylesheets/pseudocode.htm"]Pseudocode Summary[/URL] [URL="http://www.unf.edu/~broggio/cop2221/2221pseu.htm"]Pseudocode Examples[/URL] | |
Re: Hi, I have a few points that you might want to consider. If you only ever expect a single table result from the SQL query, then you can use a DataTable instead of a DataSet. The data collection part could be moved out to a private function that takes the … | |
Re: Changing the allow null in sql is not automatically picked up by VS designers. You need to manually change the AllowDBNull property of each column in your tables. You can do this in the dataset designer. | |
Re: I am guessing that you want to read a file from the computer where your app is running and store in the SQL DB. You will need to read the file in to a byte array using [iCODE]System.IO.File.ReadAllBytes("filename");[/iCODE] Then pass this as a parameter to a varbinary(MAX) column in you … | |
Re: Take a look at [post=1273473]this post[/post]. The link there is for a CalendarColumn class. If you add the CalendarColumn class to your project it appears in the column choices in the DataGridView designer and you can bind to it just like the other column types. Note: Remember to select the … | |
Re: [iCODE]Image.FromFile(str, k)[/iCODE] is in error. [I]FromFile [/I]only takes one parameter for the filename. The second parameter is a boolean for useEmbeddedColorManagement. Try [iCODE]Image.FromFile(System.IO.Path.Combine(str, k))[/iCODE] | |
Re: I suspect the OP means this. [URL="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.formview.aspx"]System.Web.UI.WebControls.FormView Class[/URL] I'm not experienced with webcontrols so perhaps someone else can help. | |
Re: if [QUOTE]tutor failed me coz he wants me to implement my own algorithm.[/QUOTE] then have a go. If you need specific help with a problem (after showing some effort) then ask. | |
| |
Re: Your regex string is looking for 4 digits inside the (). One for [1-9] and then another 3 digits with \d{3}. Change \d{3} to \d{2} and it should work. | |
Re: Re lots of excel processes. Maybe you should try to use only one excel app and open each workbook using that one only. At least you will only have one open process to worry about. Re-not closing: Your thread about unreachable code had this in it [QUOTE]System.Runtime.InteropServices.Marshal.ReleaseComObject(xlBook); System.Runtime.InteropServices.Marshal.ReleaseComObject(xlSheet); System.Runtime.InteropServices.Marshal.ReleaseComObject(xl); [/QUOTE] … | |
Re: Having this [iCODE]goto PointOfRetry;[/iCODE] inside the for loop is why you have the error. All the code beneath it (in the catch block) will never be executed. Using goto is not very good coding practice. I recommend you try to find another way; using a while loop perhaps | |
Re: Provided the base class and the engine are in the same library you can use a shared interface that is private to your code only. When implementing the interface on the base class ensure that you only do this explicitly and not implicitly. You will need to cast base class … | |
Re: If frmMainMenu is your main application form then closing it will terminate the application. What is the purpose of the login on form close? If your intention is to check that the user has permission to close the application then : [LIST] [*]In the close button just do [iCODE]this.close();[/iCODE]; this … | |
Re: If there is a lot of records then this could be a timing issue. It is not recommended to do any lengthy process in form_load. Try moving the code to a seperate method and call it from form_shown instead. | |
Re: If the data is in a database then do a seperate aggregate query. E.G. [CODE]SELECT SUM([PRICE]) AS TOTAL FROM MYTABLE[/CODE] | |
Re: Try this. [CODE]DataTable dt = this.vehiclesTableAdapter.GetDataByID(ID_Number); dt.Rows[0].ItemArray; //<--- Returns object array of row values [/CODE] | |
Re: [iCODE]myList.Capacity[/iCODE] is the maximum items allowed in the list. Because lists are dynamic this will change as items are added. What you need to test is [iCODE]myList.Count[/iCODE] which is the number of items in the list. | |
Re: Lusiphur is using a Regex to remove the "button" text from the button name. Since your buttons have the number in the button text then you can use this instead. When ever an event fires it passes the object that raised the event in the [I]sender [/I]parameter. However, to use … | |
Re: If the document is flat then you could enumerate through ChildNodes and process according to what you find. This might even be more efficient than doing about 100 TagName seaches with selectSingleNode. [Edit] or maybe not as you will have to have a big block of if then else if … | |
Re: [I]Validating [/I]events are used to help stop the user from leaving a cell with a bad value. The EventArgs usually has a Cancel property that if set to true will block the user from leaving the data entry field (cell, textbox, etc.). They are only triggered when the user tries … | |
Re: Have you tried using the [I]MinDate[/I] and [I]MaxDate[/I] properties of the DateTimePicker. I know from previous posts that you want to restrict the start date to be from today onwards so to do this you can just set the [I]MinDate[/I] property of dpSdate. To get one date to be restricted … | |
Re: If you know that the datetime is always in the same format as in your example then it will always be of a fixed length. Also, if the date is always at the start of the string then you can use String.SubString to extract the date part to test. E.g.[iCODE]return … | |
Re: You might need to test the [I]CommandName[/I] property of the [I]DataGridCommandEventArgs [/I]to only execute your command code when needed. For an example see the ItemsGrid_Command function here [URL="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.datagrid.itemcommand.aspx"]MSDN DataGrid.ItemCommand Event[/URL] | |
Re: Add takes four parameters. Look here [URL="http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.sheets.add.aspx"]Sheets.Add[/URL]. The most important one is the last one that defines what you are adding. | |
Re: That is because you have delared it [I]static[/I]. Remove [I]static[/I] from the total delcaration and see what happens. | |
Re: I like your ship. There is a native matrix transform that you can use in the [I]System.Drawing.Drawing2D[/I] namespace. Below is an example of how I might do it using a GraphicsPath. The draw method could be adapted to plot any GraphicsPath with rotation and location parameters. [CODE] // GraphicPath to … | |
Re: [QUOTE=Lusiphur] ((I was going to post this an hour ago but my phone company decided it would be a good time to perform a "DSL Conversion" for my entire area effectively killing my phone, internet and TV for an hour :@ ))[/QUOTE] @Lusiphur: Meanwhile the poor student was wondering how … | |
Re: @Lusiphur: The [I]LinearGradientBrush[/I] is used to fill a shape using linear shading. It does not draw a curved line. This will not help. I don't think there is anything native to .Net that supports drawing bell curves. May be someone else can help. | |
Re: The error is in this line. [CODE]SqlCommand cmd = new SqlCommand("insert into example values('"+txtfname.Text+"','"+txtlname.Text+"'),con");[/CODE] Check the position of your quote marks ("). | |
Re: I'm guessing that Error 1 is here [iCODE]textBox1.Text(a);[/iCODE] This should be [iCODE]textBox1.Text = a;[/iCODE] This will also clear the other error. However, you will also get a run-time error here [ICODE]deger2 = double.Parse(textBox1.Text); [/ICODE] because [I]double [/I]does not parse mathematical expressions. You will have to parse the sums yourself. However, … | |
Re: Classes do not run in threads, methods do. In case you have not solved this, here is my solution: [CODE]public void MySTAMethod() { Debug.WriteLine(string.Format("Thread ApartmentState = {0}", Thread.CurrentThread.GetApartmentState())); if (Thread.CurrentThread.GetApartmentState() != ApartmentState.STA) { Thread t = new Thread(new ThreadStart(MySTAMethod)); t.SetApartmentState(ApartmentState.STA); t.Start(); } else { Debug.WriteLine(string.Format("Clipboard.ContainsText() = {0}", Clipboard.ContainsText())); } }[/CODE] … | |
Re: The RadioButton screen has a [I]ButtonProperty [/I]property. The text there defines an installer variable name which is assigned either [I]Button1Value [/I]or [I]Button2Value[/I]. On your ProjectOutput for program A and B set the [I]Condition [/I]property to test the value of this installer variable. E.G. program A Condition : BUTTON2=1 program B … | |
Re: Yes, I am sure there are lots of people who know how to do that. However, generelly, vague request like yours do not get many replies. If you have any specific questions please ask and someone is sure to help. | |
Re: If you made changes that made it go wrong then undo those changes and try again. Otherwise, [B]post some code [/B]so that we can see what you are doing! | |
Re: [CODE]throw new ApplicationException("This book is too expensive.");[/CODE] See also MSDN Help for [URL="http://msdn.microsoft.com/en-us/library/ms173163.aspx"]Creating and Throwing Exceptions (C# Programming Guide)[/URL] | |
Re: [QUOTE=vdeych] To avoid this, use the "ref" keyword when passing your list to a function, for example: [CODE]private void SetList(ref List<string> list) { ...some code here... }[/CODE] This way, your itemsetcurrent will always point to the same data as itemset1 [/QUOTE] Lists are reference types and are passed by reference … | |
Re: I have no experience with MODI but it looks like you still have references to the [I]image [/I]and [I]layout [/I] at the point where you try to delete the image from disk. This might be what is preventing the delete working. (It might also be related to the other error, … | |
Re: You could add a static auto creating property (or method) in each of the TaskLayer classes. I use this strategy quit a lot when I want a common shared instance of a class. [CODE]namespace TaskLayer { public class A { private static A _default; public static A Default { get … | |
Re: You said that [iCODE]public string oSQL2XStreamBridge( string Name) [/iCODE] does not work. What (and where) is the calling code? If it is remote, then a string might not be returned as you expect. Try with an [iCODE]Int[/iCODE] type first to see if that works. | |
Re: I think that what you realy need to do is set the [I]TabStop[/I] property to false. This is used by forms to determine what items can have focus. The first object in the Tab Order (i.e. [I]TabIndex[/I] = 0) with TabStop true is the object that gets focus when the … | |
Re: I have this so far [iCODE]string regexstring = @"\bhtml(\d+(\.(\d*))?)?\b|[.]net\b";[/iCODE] It returns 6 matches: ".net", ".net", ".net", ".net", "html4.0", "html" But I think you want the "htlm4.0" to match as "html" only. Is that right? | |
Re: Try keeping a converted value for arithmetic tests and use TryParse when doing convertions. [CODE] int Start_Miles1_Value = 0; int End_Miles_Value = 0; private void textBox1_TextChanged(object sender, EventArgs e) { int retVal = 0; if (Int32.TryParse(label_End_Miles.Text, out End_Miles_Value) && (End_Miles_Value > Start_Miles1_Value)) { retVal = End_Miles_Value - Start_Miles1_Value; } label_Miles_Drove1.Text … |
The End.