
John_0025
Avatar/Signature-
Posts
38 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by John_0025
-
Not true. Changing the value in a textbox has no affect on the viewstate. As long as the sub is called before the page renders the new buttons will be drawn. Can you show your code?
-
Hi and welcome, It would help if you posted what you had done already so we can guide you and let you know where/if you are going wrong. Don't worry about getting it wrong we've all had to learn to program here and have all made some embarrassing mistakes along the way.
-
Have a look at using LINQ http://msdn.microsoft.com/en-gb/library/bb384429.aspx
-
Can you give a bit more information about what you want to do? If you really are thinking of making your own web browser check out the source code for Mozilla. Its open source so no stealing involved. Theoretically you could also customise it but this project has a reputation for being hard to use. Anyway if you take a look you�ll get an idea of the scale of the work needed to make a web browser. Visual Studio has a WebBrowser control you may be able to use. Take a look at http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser(VS.80).aspx
-
Do you mean the HoverMenu from the Ajax control toolkit? I don't think there is any option to change the behaviour but you can download the source code, it is open source (you should check the license) yourself to be sure about redistribution. You then just need to copy or edit the existing HoverMenu and change the handlers to listen to the onclick event rather than the mouseover.
-
I don�t think your cell will contain any text because you�re using databinding. Rather it�ll contain a databoundcontrol. I don�t really know much about how you�d get that value and how it�s persisted in a postback. You could use the item index and then finding the values from the original data source. This will mean less performance as you�ll need to re-fetch the data in the postback. protected void itemCommand(object source, DataGridCommandEventArgs e) { if (e.CommandName == "Edit") { var index = e.Item.ItemIndex; var dataSource = DataSource(); var data = dataSource[index]; Session["Username"] = data.Username; //etc } } Or you could pass the selected row are a parameter to your �Update.aspx� page and let that page find the data from your datasource. protected void itemCommand(object source, DataGridCommandEventArgs e) { if (e.CommandName == "Edit") { var index = e.Item.ItemIndex; var url = string.Format("Update.aspx?rowIndex={0}", index); Response.Redirect(url); } }
-
This is also discussed here http://www.xtremevbtalk.com/showthread.php?t=301457 is anyone else is interested in it.
-
How do you kill excel when you are finished?
John_0025 replied to mskeel's topic in Interoperation / Office Integration
:eek: I don't think killing the process is an option. Firstly I think you can only do this if you run the program with local admin rights. I'm sure other users won't get permission to do this by default. Secondly what if the user was already using Excel? You'd find yourself in a bit of trouble ;) I found GC.WaitForPendingFinalizers() helped me. -
Regular Expression with string exlusions
John_0025 replied to david7777's topic in Regular Expressions
As I understan it he doesn't want to match the b in bundled because it is between the bold tags. Apart from being a bit untidy is there anything wrong with having bold tags within bold tags. Does it become ULTRA bold :D -
You could use a structure to hold the values. Public Function myFunction() As Costs Dim objRequirements As New elantis_BUS.BusRequirements Dim decResult() As Decimal decResult = objRequirements.BOM_Explosion_Costing_Level_One(CType(Me.tvwBillOfMaterial.SelectedNode.Tag, String), CType(Quantity_From_Node_Description.Remove(0, 1), Decimal), 2) Dim costs As Costs costs.decMat = decResult(0) costs.decLab = decResult(1) Return costs End Function Public Structure Costs Public decMat As Decimal Public decLab As Decimal End Structure
-
You shouldn't have the '.*' in the square brackets. Also . and - are special characters so you need the backslash before them to use them normally try. ((\d+)|(\d+\s+))\-(.*)\.(([wW][mM][aA])|([mM][pP][3]))
-
How do you distingish between the method and property names in VB.NET? To show what I mean in C#, a case sensitive language, you can do this: public class example { private string name; public string Name { get {this.name;} } } As VB.net is case insensitive this doesn't work so what is a good convention for naming the methods and properties. Thanks
-
In my opionion it's best to avoid (.*) or (.+) in your expressions or better still avoid '.' altogther. This is really VERY generic and is what is causing your problem. You need to be more specific about what characters you want to match between the @@@ bits in your text. The @ character will be matched by the (.+) part of the expression and the program will try to match the largest string it can find. You need to make your expression say that the @ character can not be included between the '@@@' tags. This will make your expression a lot longer. ;)
-
I have a similar problem. Records in my database must have unique names. So I catch the exception. Allow the user to rename the record and then I wanted to 'retry'. I was using the goto and label stuff in VB. Not sure if this is now frowned upon in VB.net ;) Public Sub CallDB() tryAgain: Try 'Make db call Catch ex As uniqueNameException Dim errorHandler As New ErrorBox(ex, ErrorBox.buttonTypes.OkCancelBox, "Please enter a new record name.", True) If errorHandler.response = ErrorBox.Selected.OkButton Then Me.recordname = errorHandler.InputText GoTo tryAgain End If End Try End Sub Nerseus you seem to have morphed VB and C# together. :)
-
I think you should consider writing the config in XML and using XMLSerialization. It'd be much easier than reading it using regular expressions. There are plenty of web sites and books offering regular expression tutorials. You may find this site helpful, not for tutorials, but there is a pattern testing page and some good example patterns. http://www.regexlib.com John
-
"^([01]{4})+$"
-
I think it isn't returning anything. It returns the whole string because you have this: MsgBox(str) Your expression is missing an '*' Try: Dim expres As New Regex("(.)(?<tm>\d{2}:\d{2})(.*)(?<ht>\d{1}\.\d{2})(.)")
-
This can be done using groups. This allows you to name a part of the regular expression, as you would a variable, and then retrieve only this part by name. It is a very powerful feature of regular expressions. This may be a bit of a jump from what you were doing. So if you have an problems I'd be happy to help. Your text. <TR ALIGN=CENTER VALIGN=CENTER><TD><FONT COLOR='#FFCC33'> 11:40</FONT></TD> <TD><FONT COLOR='#FFCC33'>1.54</FONT></TD> This expression will match the whole of the text. I've labeled the bits you are interested in 'itemone' and 'itemtwo' \<TR ALIGN=CENTER VALIGN=CENTER\>\<TD\>\<FONT COLOR='[a-zA-Z0-9#]{1,}'\>(?<itemone>[0-9:]{1,})\<\/FONT\>\<\/TD\> \<TD\>\<FONT COLOR='[a-zA-Z0-9#]{1,}'\>(?<itemtwo>[0-9.]{1,})\<\/FONT\>\<\/TD\> To get the part of the regular expression you are interested in you can use some code like this. Not great but gives you the idea. :) Public Function ReturnValues(ByVal RegularExpression As String, ByVal mytext As String, ByVal item As String) As String() Dim myRegExp As New Regex(RegularExpression, RegexOptions.IgnoreCase) Dim Matchs As MatchCollection = myRegExp.Matches(mytext) Dim currentMatch As Match Dim matchedValues As New ArrayList For Each currentMatch In Matchs Dim myCaptures As CaptureCollection = currentMatch.Groups(item).Captures Dim currentItem As Capture For Each currentItem In myCaptures matchedValues.Add(currentItem.Value) Next Next Return CType(matchedValues.ToArray(GetType(String)), String()) End Function and call it by Dim myPattern As String = "\<TR ALIGN=CENTER VALIGN=CENTER\>\<TD\>\<FONT COLOR='[a-zA-Z0-9#]{1,}'\>(?<itemone>[0-9:]{1,})\<\/FONT\>\<\/TD\> \<TD\>\<FONT COLOR='[a-zA-Z0-9#]{1,}'\>(?<itemtwo>[0-9.]{1,})\<\/FONT\>\<\/TD\>" Dim myText As String = "<TR ALIGN=CENTER VALIGN=CENTER><TD><FONT COLOR='#FFCC33'>11:40</FONT></TD> <TD><FONT COLOR='#FFCC33'>1.54</FONT></TD>" Dim oneValues() As String = ReturnValues(myPattern, myText, "itemone") Dim twoValues() As String = ReturnValues(myPattern, myText, "itemtwo") In this example the oneValues array will contain only "11:40" and the twoValues "1.54" but if there were more lines matching the pattern, i.e. a table, then you'd get a list of all the matching numbers in that column. This is what I spend my time doing, using regular expressions to read tables of data and do calculations on it :-)
-
use the "^" and "$" characters. "^((http)|(https)):\/\/(w{3}\.)(\w)$" This will match: "http://www.w" but not "http://www.w..." or ".....http://www.w" etc. Good luck with learning regular expressions.
-
It would also match 00 as the day and allow some unrealistic years (actually depends what you are doing. Anyway show how to only allow year 19xx or 20xx) (0[1-9]|[12][0-9]|3[01])-(JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)-(19|20)\d\d
-
Sorry I deleted my 1st post. I was thinking you needed to match the whole password, which I don't think is possible in all suituations. However you only need to check there is at least 1 alpha and 1 numeric character and I assume you are not worried about matching the whole password. This should work (\d+[a-zA-Z]+)|([a-zA-Z]+\d+)
-
Some domain name do have the hyphen in and the expression you were using was to try and match all of them. If you are sure there will never be a hyphen in the name you are trying to match then you can miss it out. ([\w]+\.)+([\w]{2,3}) which will match 'www.contoso.com' but it won't match a website called 'www.j-walk.com'. Your original pattern would. I see what you are trying to do with your pattern. Maybe it might help you to start of with a simple pattern that will match your example. Then see how you would change it to deal with other host names. Try www.[a-z]{1,}.[a-z]{2,3}
-
It's a hyphen '-' so matches the hyphen in 'Xtreme-talk.com' In regular expressions the hyphen is used to show a range of allowed characters. i.e. 0-8 (matchs 0,1,2,3,4,5,6,7,8) so you have to show that you want to match a hyphen and you are not using it as a special character therefor you need to put the '\' symbol in from. '[A-Z]' matchs any letter but '[e\-t]' matchs the hyphen and will find matchs with 'e-t' in only. like in 'Xtreme-talk'. Hope this makes sense.
-
In OOP you need to be careful about the way you structure your code. Simple having code that works isn't always correct. The value for the number of wheels should be a property of the derived classes not the base 'vehicle' class. It may seem quite trivial but it means you would have to update the base class every time you derived a new class from it and this isn't quite right for OOP. Imagine if you needed to edit and rebuild 'System.Windows.Forms.Form' class everytime you made a new form. I guess in this project it won't matter at all but it's good to start good habits :)