How To Write If Not Expression
Nov 11, 2011This is ok in VB.NET: If(hash.add(Numbers[index]))However how do you write the following in VB.NET: If(!hash.add(Numbers[index]))
View 1 RepliesThis is ok in VB.NET: If(hash.add(Numbers[index]))However how do you write the following in VB.NET: If(!hash.add(Numbers[index]))
View 1 RepliesMy coworker needs me to write him a regular expression for his vb.net app.I do not know vb and he does not know regex.The regex he needs is:/.*web id: ?(d+).*/iBasically he needs to search a string for something like "web id: 345" or "web id:2534" and retrieve the ID.He took what I gave him above and was able to put this together:
Dim strPattern As String = ".*web id: ?(d+).*"
Dim strReplacement$ = "$1"
GetWebId$ = Regex.Replace(LCase$(strNote$), strPattern$, strReplacement$)
[code].....
I'm currently working in .NET 2.0 Visual Basic. The current project is an Active Directory Wrapper class library within which I have a Searcher(Of T) generic class that I wish to use to search the underlying directory for objects.
[Code]...
In short, I want to offer some kind of Expression feature to my users, unless it is too much work, as this project is not the most important one and I don't have like 2 years to develop it. I think that the better thing I should do is to write something like CustomExpression that could be passed in parameters to some functions or subs.
I have a vb.net class that cleans some html before emailing the results.
Here is a sample of some html I need to remove:
<div class="RemoveThis">
Blah blah blah<br />
Blah blah blah<br />
[Code]...
I am already using RegEx to do most of my work now. What would the RegEx expression look like to replace the block above with nothing?
I tried the following, but something is wrong:
'html has all of my text
html = Regex.Replace(html, "<div.*?class=""RemoveThis"">.*?</div>", "", RegexOptions.IgnoreCase)
I want to create a (vb.net) method and call it from an expression like this:
=Code.WhereDoIWriteThiscode(Fields!SomeValue.Value)
Where do I write this WhereDoIWriteThiscode method ?The documentation says it is an embedded method.
I'm trying to write a fraction expression on a picturebox, ExpressionBox, placed on the form at design time
Using gr As Graphics = Graphics.FromImage(ExpressionBox.Image)
gr.Clear(Color.BlanchedAlmond)
gr.DrawString(Expr(0), NormalFont, Brushes.Black, 40, 0) ' numerator
gr.DrawString("Kapp=", NormalFont, Brushes.Black, 8, 13)
gr.DrawString(Expr(1), NormalFont, Brushes.Black, 40, 24) ' denominator
gr.DrawLine(Pens.Black, 0, 20, 300, 20)
End Using
The exception occurs when the code is entered. I've used similar code elewhere in the program without problems, so why is this exception occurring here?
I've build a large program with many references. F.e.:
System.Data.DataSetExtensions
System.Linq.Dynamic
I've to write a Dynamic Linq Expression: [URL]
In my case: Dim query As IEnumerable = ds.Sales.Where(strWhere)
But with System.Data.DataSetExtensions Where is misinterpreted. The compiler expects (Datarow, Integer, Boolean). If I delete System.Data.DataSetExtensions everything is ok with this expression, but I get many other errors, so I need this reference. What can I do that the Where is interpreted correctly?
I got this Error. below is my code.
GenerateTheList is function.Need help
Private Sub buttGenerate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles buttGenerate.Click
Dim thread1 As New Thread(New ThreadStart(GenerateTheList))
thread1.Start()
End Sub
While looking in the dataset designer for a database table I am doing in visual basic 2008 I found a line for expressions under the property menu for a specific column. I need to know the code that I would put in this expression line so that this column adds up the numbers I input into three other columns and displays that number in the column. I need it to automatically calculate this for each row in the database table.
View 13 RepliesI am trying to write following expression on a datacolumn. But it results in error:Replicate('*', nLevel) + NameWhere: Replicate() is a user defined function (in a module). nLevel and Name are two other columns in same data table.
View 3 RepliesI am using Flee to build a formula builder. It works great but the only problem I'm facing is that Flee doesn't understand Generic Methods I guess. I have a function called IIf declared in the expression context I'm using. [code]How can I work around this. I mean cannot , in sense, write all possible overloads of the function of all .net primitive types. What approach should I take.
View 1 RepliesFrom this code
[Code]...
If I put New Action(AddressOf PrivateMesage), then I get the following error: Bounds can be specified only for the top-level array when initializing an array of arrays. on the following code
[Code]...
I must convert string data from a CNC that is arithmetic expression to a number that I can use in a VB application that I wrote. The following is what I get out of the cnc. [18722*65536+19377]/67108864. I need to evaluate this expression in my VB ap. The format of the string is not always the same as what I have illustrated.
View 2 RepliesI am calling this function when a button is CLICKED and received the error; The name "The" is not permitted in this context. Valid expression are constants, constants expression, and (in some contexts) variables. Column names are not permitted. Unclosed quotation mark after the character string 'True)'.
The function is as follows;
Private Sub Save()
Dim conn As SqlConnection = GetDbConnection()
Dim query As String
Dim cmd As New SqlCommand
I would like to know the equivalent expresion in VB for this C# expression: Container.TotalRowCount > 0 ? Math.Ceiling(((double)(Container.StartRowIndex + Container.MaximumRows) / Container.MaximumRows)) : 0
View 3 RepliesI have a trouble making this code work. When executed, it just creates a correct (with the correct name) file with the extension .txt but the the actual text inside .
Imports System.IO
Public Class Form1
Public mytext As String
[code]...
The strange thing is that while debugging, h, t string variables have the correct values, but somehow mystream.write(t) doesnt work (it doesent write anything to my h.txt text file...
Ok i saw this guy on youtube that made a achievement generator for his computer. For example, he goes to notepad and write something and saves it and gets the xbox 360 achievement pop up saying "Gotta write this down" and all that. Cud this have been coded thru VB.NET or something?
View 1 Repliesi have a notification j-query plugin .. i taste it in my page (working 100%)but when i want to use it in a event SqlDataSource1_Deleted with the response.write method it does not work
Protected Sub SqlDataSource1_Deleted(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceStatusEventArgs) Handles SqlDataSource1.Deleted
Response.Write("<script type='text/javascript'> showNotification({message: 'This is a
[code].....
I want to write a program to write in an xml file in this format:
<?xml version="1.0" encoding="utf-8" ?>
- <Orders>
<Item id="1" SKU="998123" Description="Super Widget" Quantity="100" />
[Code]....
I'm trying to write a sub that will write to a file. here is what i have:
Public Sub LogMe(ByVal MyType As String, ByVal MyMessage As String)
Dim LogStream As FileStream 'should be at a level with enough scope for your logging
[Code]....
The problem is that this will just overwrite what is already there. I would like to have it append the EHomeLog.log every time it is called.
I know I can create XML ouput in Example 1 as follows using the following code in Example 2. How do I create the same output in Example 3?[code...]
View 9 Repliesi have a string similar to this one:
Hi, <<
ame>> <<surname>>, this is an example << est>>.
I what a regex that match and split this string in:
"Hi, "
<<
ame>>
" "
[code]....
I tried this one: (<<*.*?>>)|(>>*.*?<<), but doesn't work.
What is the vb.net expression of this c# expression ?
Frame.GetController<ShowNavigationItemController>().CustomShowNavigationItem += new EventHandler<CustomShowNavigationItemEventArgs>(WindowController1_CustomShowNavigationItem);
I'm not sure if this is possible but I would like to associate a class name reference to a shared member method / property / variable. Consider:
Public Class UserParameters
Public Shared Reference As Object
Public Shared Function GetReference() As Object
[Code]....
In another part of the program I would like to simply call UserParameters and have it return Reference either by aliasing GetReference or the variable directly.
I am trying to emulate the Application, Request, or Session variable:
Session(0) = Session.Item(0)
I am dumb founded at this statement....maybe its just too many hours/days of doing C# to VB.Net conversion but i am drawing a blank on this conversion.
List<string> sColors = new List<string>(this.CustomPaletteValues.Split(','));
try {
List<Color> colors = sColors.ConvertAll<Color>(s => (Color)(new ColorConverter().ConvertFromString(s)));
What i have so far:
Dim colors As List(Of Color) = sColors.ConvertAll(Of Color)(....)
As you can see its the content of the lambda that i am hitting a brick wall with.
I saw an example of using Expression Builders, and creating your own Custom Expression Builder Classes here: [Url] However, I fail to see the value in using this approach. It doesn't seem much easier than programmatically setting values in your code behind. As far as I can tell, the only thing you can do with them is set properties. Maybe they would be useful for setting defaults on certain controls? Can anyone shed light on where this ASP.NET feature becomes powerful?
View 4 RepliesThe code you posted while similar to VB6 has method and syntax that is very similar to Crystal Reports Scripting Language
[Code]...
i didn't want to trust this one to any number of online conversion websites that I often use.I don't need to convert the declarations, just the expression '(byte)((flen & 0xff00) >> 8)'in
byte[] sendFrameData = new byte[280
ushort flen
sendFrameData[7] = (byte)((flen & 0xff00) >> 8);
'I am having trouble with the line "senda = suba(sendaobj, EventArgs.Empty)". [code]...
View 12 RepliesHere's the
Sub DestroyUser(ByRef Victomcheck As Integer, ByRef Victorcheck As Integer)
Dim num As Object
WriteSub("destroyuser")
[Code]......