I have a string: Dim strXMLTags As String = "<tags><test>1</test></tags>" And I want to verify that all opening tags have a closing tag in the proper place. So if I put the previous string through, it'd work. However, if I put: Dim strXMLTags As String = "<tags><test>1</test>" Then I want it to give me an error. Is there an XML structure checker or something of the sorts? Or should I just try and load it to an XML document and if it errors then, then I know.
I am trying to verify that a string contains nothing but known values. In this case, I need to make sure it contains only "Shift", "Control", or "Alt", but not necessarily all of those. For example, these should be true: "Shift + P", "Shift + Control + H", "Alt + U; but these should not: "Other + P", "Shift + Fake + Y", "Unknown + Shift + E" etc.This is the code I tried to use:
If Not shortcut.Contains("Shift") Or Not shortcut.Contains("Control") Or Not shortcut.Contains("Alt") Then MessageBox.Show("Invalid") End If
I'm having difficulty wrapping my head around the needed logic to do this. I'm assuming there's a logic operator that can do this?
I have a masked text box used to create an inhouse Fips code, the first 2 characters are the state abbreviation then 3 numbers. With the format on the mtb set to LL-000, i don't need to worry about the numbers. I am trying to see if a string contains the 2 characters I need from an array, but it isn't working the way I thought it would.
Dim toUpperCase As String = mtbFipsCodeTab.Text.Trim().ToUpper() mtbFipsCodeTab.Text = toUpperCase Dim fipsArray() As Char ={"AK", "AL", "AR", "AZ", "CA", "CO", "CT", "DC", "DE", "FL", "GA", _ "HI", "IA", "ID", "IL", "IN", "KS", "KY", "LA", "MA", "MD", "ME",
I am making a program that Calls on a string in a dll to verify that the program is registered. Any idea on what functions I need and how to write a string in a dll?
I have a script that attempts to load XML text from a URL and I am having difficulty figuring out how to check to see if it is valid, normalized XML. I don't have a schema as there are several variables which could change the XML format, I just want to check to make sure all of the opening tags are closed properly so I can verify that the entire string loaded properly.
Here is what I have right now. Dim objResponse As HttpWebResponse Dim objRequest As HttpWebRequest Dim strXml As String Dim newMembers As New DataSet Dim xmlReader As StringReader [Code] .....
I would like to add something here to validate strXML ' create a dataset from the XML file pulled down from the remote server newMembers = New DataSet() xmlReader = New System.IO.StringReader(strXml) newMembers.ReadXml(xmlReader)
I am trying to create a web-method to check whether a string contains a word which is in a list of 'not allowed' words. This list will be updated from time to time.
<System.Web.Services.WebMethod()> _ Public Function checkword(ByVal Id As String) As String Dim returnValue As String = String.Empty
[Code]...
Something is wrong with this function. It verifies the first word of string. After that it doesn't return anything.
writing an XML-formatted string so that I may later encrypt it.If I create an XMLDocument,it will insert its formatting tag <?xml version="1.0" encoding="Windows-1252"?> and I need to avoid this.I'm not very familiar with streams, or how to output an XMLWriter to one.
I have masked textboxes which occasionally have numeric input that contains zeros. I copy the input to an instance of a structure (that is, to a string property of the structure), and the input--if it has zeros--tends to lose those zeros. For example, if I have "9034040," and place it to the string, it actually become "9 34 4 " with spaces in place of those zeros.
I am trying to convert text in a text box (txtEventDate.Text) to a date type in a structure: ThisEvent.EventDate (declared as date). The text in the textbox is of the form: 05/18/1927 (i.e. May 18th, 1927) and after looking long and hard thru the forums attempting several different things, like:
The code is commented out because none of them convert the string to a date value (I know a date does not have a format and I have looked thru the MSDN). How can I stay logged and composing a thread past some arbitrary time limit that forces a re-login?
I've got this Function: Public Class QueryStringUtil Public Shared Function GetQueryStringValue(Of T As Structure)(ByVal queryStringVariable As String) As T Dim queryStringObject As Nullable(Of T) = Nothing If queryStringVariable <> Nothing Then If HttpContext.Current.Request.QueryString(queryStringVariable) IsNot Nothing Then queryStringObject = CTypeDynamic(Of T)(queryStringVariable) End If End If Return queryStringObject End Function End Class
When I try to call it like this: Dim intTest As Integer = QueryStringUtil.GetQueryStringValue(Of Integer)("stuff") Dim stringTest As String = QueryStringUtil.GetQueryStringValue(Of String)("stuff") Dim datetimeTest As DateTime = QueryStringUtil.GetQueryStringValue(Of DateTime)("stuff")
stringTest gives me the error: 'String' does not satisfy the 'Structure' constraint for type parameter 'T'.
I want our other developers to not worry about having to convert a class to a structure or some stuff like that when they call this function. I just want them to be able to put a standard type in the (Of T) and have it work. I don't mind writing in extra calculations to achieve that. The other problem is I also need the function to be able to return an actual null value, so I kind of need the queryStringObject as Nullable(Of T). Which means I have to have T as Structure otherwise it tells me that won't work. So looks like if I change what T is I need to run some calculation to delcare the var as nullable or not.
I tried overloading this method so that one returns T and one returns Nullable(Of T) like so: Public Shared Function GetQueryStringValue(Of T As Class)(ByVal queryStringVariable As String) As T Public Shared Function GetQueryStringValue(Of T As Structure)(ByVal queryStringVariable As String) As Nullable(Of T) And naturally it's telling me it can't do that since they just differ by return types. Is there anyway to overload this? I really don't want to have two functions.
I am trying to strip the first 75 characters from various strings (sentences / phrases) and it seems right but I need to ensure that the no words are truncated in the process. Meaning that if the 75 character is part of a word it needs to fall back to the beginning of the word or nearest space..
I thought of stripping the entire string into separate words and then counting the length of combining the words and stopping when I reach the target but what do I do in the case when it is not a valid sentence just a bunch of characters jammed together or spaces and one character. I thought of using grammar parsing tool libraries and parsing into tokens etc but that seems too over complicated.
Here is what I have so far:
If htext.Length() > 75 Then Dim regex2 As Regex = New Regex("^.{0,75}", RegexOptions.IgnoreCase) Dim m2 As Match = regex2.Match(htext)
Module Module1 Public Structure structure1 Public TRANS() As structure2 End Structure Public Structure structure2 Public X() As Integer End Structure End Module
I'm new to VB 2008 after having spent a long time with VB6, so I apologize if this is a stupid question. But I'd really like to have this straightened out.
Let's say I have a pretty large structure that has lots of properties.
Code:
Now say that I want an internal database with about 10 instances of this structure total, describing, say, 10 different products that a store sells. When these values are loaded from a database, they remain totally static. (However, they can be different each time a program loads)
Now say that I have a class. Each instance of this class is a type of that BaseProduct structure. Meaning, each instance of the class pertains to one of the 10 types of products that the store sells. However, this class has additional properties that pertain specifically to each instance, which are not static.
Code:
Now, the problem here is... If I have 200 different transactions, each one contains an instance of BaseProduct. BaseProduct is HUGE, and is largely redundant (only 10 types possible), so I think it's a little silly to include a whole copy of it with EVERY transaction. However, the Transaction class really needs information regarding the base product it pertains to. Is there a way to, instead of declaring a New BaseProduct in the Transaction class, to simply make one of the properties of the Transaction class a pointer to a BaseProduct variable?
In VB6, I would accomplish this by making a BaseProduct(10) array, and then giving each Transaction an ID number referring to an entry in that array. But in VB 2008, using class structure, this is impossible. I can't define the BaseProduct(10) array outside of a class in a namespace, and if I define it in the actual application's form, then the class loses modularity since it relies on the application that's using it.
I am trying to communicate with an external device and i am trying to send a byte array to the external device via sockets but i am always getting a response the message size is too small so i am not sure what i have done wrong. Between the data type there should be no alignment present and all numbers are represented in little endian format. The char array is not null terminated as mentioned in the protocol specifications.
I have to send data based on a struct that embeds 2 other struct. So here's my vb.net code for the struct used to convert to byte array and the sending part.
Public Structure MESSAGETYPE_OIP_Login Dim Header() As COMMANDHEADER Dim UserName() As PSTRING
I'm having a problem that's driving me crazy; I can't understand how to convert the XML structure into a class structure (that I want to use to hydrate a XML document).
The XML document looks like this:
xml <?xml version="1.0" encoding="utf-8"?> <artists xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns="http://www.spotify.com/ns/music/1">
I've created a little procedure that I use to verify if a value does actually exist. I'm currently using this all throughout my application for things such as verifying if a control's EditValue actually has a value. I was wondering if I have missed any scenarios where a value would not be available, missing, non-existent, blank, etc., and how would I incorporate in my procedure.
Public Function ValueExist(ByRef CheckValue As Object) As Boolean Try ValueExist = True If IsDBNull(CheckValue) Then ValueExist = False [Code] .....
I have not been able to successfully verify a user with LDAP for an ASP.NET web application. I have done so on our own network against Active Directory, but this is against a server outside of our network that is OID (Oracle Internet Directory).Usually, I use the following code with no problem.
Dim myDirectoryEntry As New System.DirectoryServices.DirectoryEntry("LDAP://1.2.3.4:999/OU=SomeOU,DC=Something,DC=com") myDirectoryEntry.AuthenticationType = System.DirectoryServices.AuthenticationTypes.Sealing myDirectoryEntry.AuthenticationType = System.DirectoryServices.AuthenticationTypes.Secure Try
[Code]...
After that, I haven't been able to find a method to verify a user's log in information with their password and then pull back some information.
I know this is a stretch, but I am looking for some .NET help with checking Joomla passwords.For those not familiar with Joomla password scheme, it looks like this: {MD5Hash}:{SALT}HEre is the code I am using:Joomla password:
9322a02004887255b76a6a8e8971aea7:5JTTaPQjA88247nCKkTILtv8TXFtZCED User submitted password: 123456 Dim m5t() As String = dr("password").split(":") // splict Joomla password
What is the easiest way to verify if a number is odd or even?I'm setting up a program, and it is checking if a user input number is even or odd, if its odd, it runs this, if even, it runs this.Its a simple if/then, else statement.