Quantcast
Channel: SharpDevelop Community
Viewing all articles
Browse latest Browse all 1764

Conversion Error from c# to vb with LIST assignments

$
0
0

Hi guys.

Fantastic code snippet conversion tool.

http://codeconverter.sharpdevelop.net/SnippetConverter.aspx

I converted :

        public DialogExpression searchDoc()
        {
            string DBFieldName, searchValue;
            int i = 0;

            List<DialogExpressionCondition> Condition = new List<DialogExpressionCondition>();

            foreach (var item in flowLayoutSearch.Controls)
            {
                if (item.GetType().ToString() == "System.Windows.Forms.TextBox")
                {
                    DBFieldName = flowLayoutSearch.Controls[i].Name.Substring(7);
                    searchValue = flowLayoutSearch.Controls[i].Text;

                    Condition.Add(new DialogExpressionCondition()
                    {
                        DBName = DBFieldName,
                        Value = new List<string>() { searchValue, searchValue }
                    });
                }
                i++;
            }

            var q = new DialogBLOCKED EXPRESSION
            {
                Operation = DialogExpressionOperation.And,
                Condition = Condition
            };

            return q;
        }

And got the RESULT:

Public Function searchDoc() As DialogExpression
 Dim DBFieldName As String, searchValue As String
 Dim i As Integer = 0

 Dim Condition As New List(Of DialogExpressionCondition)()

 For Each item As var In flowLayoutSearch.Controls
  If item.[GetType]().ToString() = "System.Windows.Forms.TextBox" Then
   DBFieldName = flowLayoutSearch.Controls(i).Name.Substring(7)
   searchValue = flowLayoutSearch.Controls(i).Text

   Condition.Add(New DialogExpressionCondition() With { _
    Key .DBName = DBFieldName, _
    Key .Value = New List(Of String)() From { _
     searchValue, _
     searchValue _
    } _
   })
  End If
  i += 1
 Next

 Dim q = New DialogBLOCKED EXPRESSION With { _
  Key .Operation = DialogExpressionOperation.[And], _
  Key .Condition = Condition _
 }

 Return q
End Function

The Problem is  "Key .Value" should be only ".Value" in VB.

 

greets Jens

(I´m using Studio 2015 Community Edition)

 


Viewing all articles
Browse latest Browse all 1764

Trending Articles