Wrap Sub As Function For Use In Lambda?
Mar 25, 2010
I have a problem with VB9 and Moq.I need to call a verify on a Sub. Like so:logger.Verify(Function(x) x.Log, Times.AtLeastOnce)And my logger looks like this:
Public Interface ILogger
Sub Log()
End Interface
[code].....
View 2 Replies
ADVERTISEMENT
Jun 24, 2011
Consider the following C# code:
private void SomeMethod()
{
IsBusy = true;
var bg = new BackgroundWorker();
bg.DoWork += (sender, e) =>
[code]....
However, I'd like to be able to implement a method like SomeMethod from the C# example in VB.net. Likely this means wrapping the Backgroundworker in another class (which is something I want to do for dependency injection and unit testing anyway).
View 2 Replies
Dec 14, 2009
Is it possible to shorten the following function to a lambda expression?Or (to do the trick by myself) what is the best and most understandable for beginners tutorial for lambda in vb.net?[code]
View 2 Replies
Apr 19, 2012
I have the following code which assigns values to a datarow and and adds to the datatable. I want to write function which returns a datarow which enables me to write less code.
objRow = dtTODO.NewRow
objRow.Item("Item") = "Test"
objRow.Item("Message") = "Test"
[code].....
View 1 Replies
Oct 6, 2011
I have this function that maps a IDataReader to a class. It is obviously written in C#. My co-worker wants to use the same method in his code, but he is writing in VB.net. Basically I am having difficulty rewriting this due to the Lambda expressions used in C#. He is running .Net 3.5.
[Code]...
View 3 Replies
Apr 24, 2012
Should I be concerned about the performance of the Compile method here?[code]...
The reason I want the lambda expression is because I want that function to be able to get all the way through LINQ-to-SQL to be converted to SQL. The reason I want the direct version is because I have other code that I want to validate individual serial numbers before submitting changes. And I fear that GetValidSerialNumbers.Contains(serialNumber) will execute a more-complex-than-necesssary query.
View 1 Replies
Aug 12, 2009
I'm trying to sort a list of string, which (each item) consists of a word followed by a space, then a number. I want to sort first alphabetically by the word, then numerically by the number. I tried something like this:
wordList = wordList.OrderBy(Function(x, y) CStr(x.Split(" "c)(0)).CompareTo(CStr(y.Split(" "c)(0)))).ThenBy(CInt(x.Split(" "c)(1)).CompareTo(CInt(y.Split(" "c)(1))))
View 5 Replies
Jan 24, 2010
I am trying to pass a lambda function to Linq's orderby and cannot get it to work.
The relevant code is:
Dim myordering = Function(m) m.Count
If isAlphaOrder Then
myOrdering = Function(m) m.Key 'Order by Alphabet
[Code].....
View 4 Replies
Mar 31, 2009
I have a lambda function that I can assign to a field and pass it to a sub routine, but cannot assign to a property. My field is defined as follows:
Public Delegate Sub SubDelegate()
Private pDeleteFunction As Func(Of BookCaseRow, SubDelegate)
[code].....
View 3 Replies
May 18, 2011
I'm trying to create a generic function to build a Linq expression from a list of Telerik grid filters. I'm trying to stay clear of dynamic Linq. Because I don't know the type that I'm building the expression for, I'm attempting to use reflection in the lambda functions to refer to a property, but after applying the fix suggested by @JaredPar I get the error, "The LINQ expression node type 'Invoke' is not supported in LINQ to Entities." Is there any way around this? here is my code:
Public Shared Function buildRadFilter(Of T)(ByVal filterExpression As List(Of GridFilterExpression)) As Expressions.Expression(Of Func(Of T, Boolean))
Dim returnPred = PredicateBuilder.True(Of T)()
[Code]....
View 1 Replies
Mar 29, 2010
I have the below C# Lambda function and I need to convert it to a VB.Net code. I tried many times but I couldn't convert it the right way. [code]...
View 10 Replies
Jun 29, 2010
I'm trying to use a nested multi-line lambda Function in VB.NET and am getting an error. Here's what my code looks like:
cartItems = cartItems.Select(Function(ci) New With {.CartItem = ci, .Discount = discountItems.FirstOrDefault(Function(di) di.SKU = ci.SKU)})
.Select(Function(k)
If k.Discount Is Not Nothing Then
[code]....
View 2 Replies
Jun 21, 2011
Im hearing about this, can someone explain it to me or please show some basic code of Lambda with explanation.
View 2 Replies
May 21, 2012
I have two question regarding Tab control of .net(3.5). I am working on windows application. Wrap text in Tab control(title) so that it will come in two lines Round corner insted of square corner of tab control
how can I do using vb.net or C#.
View 2 Replies
Jun 8, 2011
How to merge and wrap text in vb.net or in excel?
View 1 Replies
Mar 16, 2010
How do I wrap button text? When the button text is to large for the width of the button the remaining characters should go to the next line instead of going off the button.
View 7 Replies
Apr 7, 2009
I have a dll that was compiled in Borland C++ 5.5 that I wish to use in a vb.net 2008 project. The problem is that Borland is OMF and MS requires COFF.
Can you direct me to how to convert from OMF to COFF, or how to create a wrapper. I fumbled with pinvoke a little bit, but with no success.
View 3 Replies
Jan 6, 2011
How can I wrap my app into an executable file?
View 1 Replies
Oct 1, 2011
I'm adding rectangles to a wrap panel like this:
For i = 0 to 20
wrapPanel.children.add()
next
I would like to use this loop because I don't want to specify the limit:
Do
wrapPanel.children.add()
Loop
But how can I break the loop when the wrap panel is filled? For example the loop would stop when the wrap panel can't display a rectangle in its full height or width.
View 1 Replies
Oct 18, 2011
I am trying to wrap a value in a cell using EPPlus and VB.net / ASP.Net
View 1 Replies
Feb 6, 2012
I have some very long datasets how can i setup so they wrap in the Datview grid rows??
View 2 Replies
Aug 12, 2009
I have the following code in my vb.net:
Code:
In the GRNNo, there are around 10 character, but I would like to wrap the text after 5 character. However, although I had create a function to make it wrap, but it will display "12345..." rather than wrap the text.Anyone can teach me how to wrap the text?
View 4 Replies
Apr 16, 2010
I have a string of code which builds out an answer and question as you would see on a medical form.
strDisplay &= strMyAns & Space(5) & ControlChars.Tab & MyQ & ControlChars.Tab & Environment.NewLine & Environment.NewLine
Results look like attached .gif. Is there an easy way in VB to indent when the question exceeds space on a page?
View 2 Replies
May 26, 2009
I've tried changing the RowStyle Wrap property and every Wrap property in the grid. How do I stop word wrap in a Gridview no matter what size the Row's Text Length is?
View 4 Replies
Dec 18, 2009
Does anyone know the code for a line count with word wrap on. I can only work out code that only works without word wrap and can't find any on the internet which does work with word wrap. It's for a RichTextBoxPrint control.
View 7 Replies
May 9, 2012
I am creating a WorkSheet from code. I need my columns to word wrap and not run over (see red arrow below). Not really sure how to do it. Tried to set it for the range of columns with no luck. Here's the current output:
Here's where I try to set it:
Protected Sub Button1_Click(sender As Object, e As System.EventArgs) Handles Button1.Click
Dim xlApp As Excel.Application
[code].....
View 2 Replies
Jun 23, 2010
i have text in textbox1.text How can i wrap html tags around that text by clicking a button. Example : Textbox1.text has "Hello there" in it When i click a button i want it to display :
HTML
[b]Hello there[/b]
How can i do this ?
View 7 Replies
Mar 24, 2011
[Code]....
I need to see the next line in the datgrid.
View 8 Replies
Jul 30, 2009
I am doing a Windows Form Application assignment (Simple User Interface Text Editor - practically my own version of MS Notepad) for my VB.Net course... I have practically completed the project however there were certain items we had to add to one of the dropdown menus one being Word Wrap (Under the Edit drop down). I am really confused as what to do here for the WordWrapToolStripMenuItem_Click event handler?!
[Code]...
View 7 Replies
May 29, 2009
I'm having a problem using XML literals with a StringBuilder in VB 2008. If I use this code everything is fine.Dim html As New System.Text.StringBuilder
html.Append(<html><body></body></html>)
MsgBox("hello")
Now the problem is I want to wrap HTML around something that is generated in code.
html.Append(<html><body>)
msgbox("nothing happens")
When the HTML doesn't have the corresponding ending tag, it acts like it goes beyond the ) and keeps looking for it.
View 4 Replies