Translating 'New' Arrays To C#

Dec 9, 2011

I'm trying to translate some code from VB.Net to C#, but I've run into an issue.The Vb.Net line of code I want to translate is:[code]However, this is giving me a nasty 'Object reference is not set to an instance of an object' error.

View 3 Replies


ADVERTISEMENT

Translating A C# WCF App Into VB

Oct 15, 2010

I'm trying to write a simple/small Windows Communication Foundation service application in Visual Basic (but I am very novice in VB) and all the good examples I've found on the net are written in C#. So far I've gotten my WCF service application working but now I'm trying to add callback functionality and the program has gotten more complicated. In the C# example code I understand how everything works but I am having trouble translating into VB the portion of code that uses a delegate. Can someone please show the VB equivalent?

Here is the C# code sample I'm using for reference:

[code...]

Is that casting the callback object as type ICommunicationObject? How is that done in VB?

View 3 Replies

Translating C# To VB?

Feb 18, 2010

I have to admit, I can't always translate C# code to VB. Case in point:the MSDN library has the definition and example of an FTPWebRequest in C#, but not in VB. I think I can understand most of it, but can someone translate the small snippet below for me? Don't worry about the variable definitions, I've got that, but I can't tell of the subsequent methods are functions or sub routines.And what are those "get" and "set" calls?[code]......

View 6 Replies

C# To VB Not Translating Well With CUINT?

Sep 2, 2010

Having trouble converting a bit of C# code to VB.NET.I got his code from CodeProject:

[Code]...

View 1 Replies

Translating A Function From PHP To .NET?

Mar 25, 2011

I am more of a PHP Coder then VB.net Programmer so I made this and converting this function.

<?php
function grabshade($r,$g,$b){
$colors = array(array(0, 0, 0), array(255, 255, 255));
$differencearray = array();

[code]....

View 3 Replies

Translating Function From C#?

Jul 31, 2011

I'm not the best at reading and translating C#.

public IEnumerable ActiveEntities
{
get { return GetActiveEntities(Query); }

[Code].....

View 4 Replies

Translating Hex To Numerical?

Jan 16, 2011

what I am trying to do it read a form of hex that is encoded I know the cypher what I want to do is make a program for myself that will let me compare 2 files. Both in hex decypher the hex to numerical.I call the hex backwards hex what I mean is this..in stead of "04 58 d2 d2" it is "d2 d2 58 04" I know the number it translates to is 72930002I want to show the entire list in a list box where I can choose wich I want to look at.

View 8 Replies

Asp.net Mvc 3 - Translating The Razor Syntax?

Jan 25, 2011

MVC 3 is great but in some cases I am having trouble translating the Razor syntax. Anyone know of a good VB.Net Razor reference?

View 1 Replies

Translating A Piece Of C# Code

Aug 6, 2009

I am translating a piece of C# code into VB.NET using online convertors..[code]The VB.NET translation is not up to the mark and gives compiler errors Any VB.NET expert who can suggest what to change to make the code compile?url.

View 10 Replies

Translating A Small C# WCF App Into VB (part 2)?

Oct 18, 2010

I recently asked a question about translating a code sample I found on on the internet from C# into VB and I was given links to websites that automate code translation [URL].. I am very new to VB and unfortunately the VB that the translators returned doesn't compile in Visual Studio 2010. I am hoping someone can help me fix the non-working portion of VB code.

Here is the C# code I am converting into VB:

[Code]...

View 2 Replies

Translating Delegate Usage From C# To VB

Apr 1, 2010

In physics library written in C# I have the following code:

[Code]...

I'd like to do the same in VB. (just thandling the delegate, not the declaration) I tried this, but it doesn't work: AddHandler ContactManager.PostSolve, AddressOf PostSolve The following works, but only allows me to have one handler for the delegate: ContactManager.PostSolve = new PostSolveDelegate(AddressOf PostSolve) Is there a way for me to do the same thing in VB that was done in the first piece of code?

View 2 Replies

Translating VB To C# - Type Conversion?

May 9, 2011

with translating some code from VB to C#.

Public Function ToBase36(ByVal IBase36 As Double) As String
Dim Base36() As String = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U",

[code].....

View 3 Replies

VS 2008 Translating A C# Snipet Into VB?

Aug 18, 2011

I am writing a program in visual studio to exchange data with a webservice. The webservice, Kareo.com, gives an example of a program but it is in C# - I am trying to replicate their program in visual basic, which is the language that I am more comfortable with. I got most of it to work but am running into problems with two lines "patientCase.Policies = new InsurancePolicyCreateReq[] { primaryPolicy, secondaryPolicy };" and "newPatient.Cases = new PatientCaseCreateReq[] { patientCase };"the C# version of the entire program is below.

[Code]...

View 2 Replies

VS 2010 Translating Code From C# To .net?

Apr 16, 2012

Just a quick question, what will this code be in vb.net? if this is the wrong place for this request.

[Code]...

View 1 Replies

C# - Errors Translating Regex From .NET To Javascript?

May 19, 2011

I have this piece of VBNet code that i would like to translate into javascript:

Dim phone_check_pattern = "^(+?|((+?[0-9]{1,3}))|)([ 0-9.//-]|([ 0-9.//-]+))+((x|X|((e|E)(x|X)(t|T)))([ 0-9.//-]|([ 0-9.//-]+)))?$"
System.Diagnostics.Debug.WriteLine(System.Text.RegularExpressions.Regex.IsMatch("test input", phone_check_pattern))

my translated result:

var phone_check_pattern = "^(+?|((+?[0-9]{1,3}))|)([ 0-9.//-]|([ 0-9.//-]+))+((x|X|((e|E)(x|X)(t|T)))([ 0-9.//-]|([ 0-9.//-]+)))?$";
alert(new RegExp(phone_check_pattern).test("test input"))

However when i run it it has error Uncaught SyntaxError: Invalid regular expression:: Nothing to repeat

(my VbNet code doesn't have any error though)

View 3 Replies

Make Some Special Translating Program?

Jun 9, 2011

i'm starting to learn vb.net, and i trying to make some special translating program, its need to translate hebrew text into special letter sequence. the text input are: ב יית בי יי ים מתקדמים (which its means Construction of advanced buildings ) And the text output are: BPJJZ_BJPJJPJM_NZWDNJM according to the list i made (Attached picture).

[Code]...

View 17 Replies

Translating Letters To Numerical Values

Nov 4, 2010

I want my code to look at a textbox to determine which letter is in it, & assign a numerical value to a second textbox, based on what letter is in the first textbox.[code]The problem is that, when I step through the code, I can see that Form20.txtGrade1.text DOES EQUAL "C", but my code skips over the part that says Form20.txtGrade1a.text = "4". Instead, if I hover over that part, I can read Form20.txtGrade1a.text = " ".When I do not step through the code, and just run it, I see the two textboxes, with the first one containing the C, and the second one is just blank.

View 4 Replies

Translating Text From Some Language To English

Feb 25, 2009

In my current project, i need to build a tool to translate text from some languages to English
Ex.: Chinese To English
Is there any translation SDK available?

View 3 Replies

Small Errors When Translating Code From C# To Program

Feb 19, 2012

I have almost completed a translation from C# to VB.NET, however, I run into some small errors[code]...

View 1 Replies

VB6 Used Recordsetsor Arrays - .Net Framework In VB2010. Datasets, Dataviews. Tableadapters, Arrays. Enums ?

May 9, 2010

In VB6 I load a recordset containg all of the records (6 fields per record)in a table into an XArray and then manipulate the records in the array and then write them back to the original table. The array issorted by the first field (1 to maybe 8000 or more) I need to find records in the array by an ID field and then move them (because of some external criteria that happens many times) from say number 400 to number 375. Then all of the other records between 375 and 399 were renumbered up 1 to fill the gaps left by the move.

The XArray worked well as it could find and also move to a next record easily to facilitate the revisions to each record quickly. Everything is done in VB6 in code and nothing visual needs to be shown to the user until say 2000 of these external changes are complete. What is the best, most efficient way to do this in the .Net framework in VB2010. Datasets, Dataviews. tableadapters, arrays. enums ?

View 3 Replies

Integer Arrays - User Enter In Big Integers Using - Two Parallel Arrays

Dec 10, 2009

My assignment is to have a user enter in big integers using what i think is two parallel arrays. I got this far but now im stuck. I think i need to actually convert the text box input into an array but i do not know how to do that. I am all over the place in this project.

'Created/ Revised by: Jessica Falcetta
'Cap 204 Final Project: Big Integer Project
'Project Purpose: To calculate large integers through parallel arrays

[CODE]...

View 5 Replies

Passing Arrays Through Fortran Dll From App Turning To Single Element Arrays?

Feb 2, 2010

I have a VB.net console app and I am opening a function in a dll written in fortran. I am passing 3 arrays through the function by reference. When they come back out the otherside they ahve all tunred to arrays of only one element And that element is 0.I read on the internet somewhere that when doing this kind of thing it is a good idea to only pass the first element of the array into the function.I tried changing my function declaration to accepting single elements rather than single dimensional arrays, and now the arrays are the same length before and after the function call, but they don't seem to be changing at all, so i'm not sure that this is working

View 1 Replies

VS 2008 Arrays Displaying States/searching Arrays?

Oct 30, 2010

the statement Dim state(49) As String and maintain a list of certain states. The list of states should always be in alphabetical order and occupy consecutive elements of the array. The buttons in the program should give the user the following options: (a) Take the state specified by the user in a text box and insert it into its proper position in the array. If the state is already in the array, so report. (b) Take the state specified by the user in a text box and delete it from the array. If the state is not in the array, so report. (c) Display the states in the array. "

Private Sub states_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
state(0) = "Alabama"

[code]....

View 1 Replies

VS 2010 Translating Form Data (fetched From Mysql) To Excel Doc?

Oct 17, 2011

translating form data (fetched from mysql) to excel doc how can i do it? i saw a couple of examples but none worked only in vb6?

View 3 Replies

Translating Decompiled Code - Function That Accepts An Item Name Its Cost And Its Quantity

May 6, 2011

I was wondering if someone could translate this code into a more understandable code. It is suppose to be a function that accepts an item name its cost and its quantity. and adds one more array element to ."items" variable and assigns the given name and cost and quantity.

Public Sub AddItem(ByVal strName As String, ByVal dblCost As Double, ByVal intQuantity As Integer)
Me.items=DirectCast(Utils.CopyArray(DirectCast(Me.items,Array),New Purchase(me.itemsCount + 1)-1){}),Purchase())

End Sub

This is the translation i made but i don't think it is correct.

Public Sub AddItem(ByVal strName As String, ByVal dblPrice As Double, ByVal intQuan As Integer)
Dim items As Purchase() = Me.items
Dim itemCount As Integer = Me.itemsCount
For itemCount = 0 To items.Length - 1

[CODE]...

View 3 Replies

.net - Translating C Code Using OpenSSL For Public-key Authentication To VisualBasic.NET Using System.security.cryptography?

Oct 20, 2009

I am trying to mimic the results of some C code that uses the OpenSSL library using the system.security.crytography library in the .net 3.5 world, and I can't seem to get it right. part of the issue is my understanding of crytography in general.

Here's what is supposed to happen:

I send a request for authentication to a device.It returns a challenge digest, which I then need to sign with a known key and return The device returns a "success" or "Fail" message.I have the following code snippet that I am trying to "copy":

[Code]...

View 4 Replies

Comparing Arrays :: Possible Without Iterating The Arrays?

May 3, 2010

I was wondering if anyone knows a built in method ( LINQ say or a LAMBDA expression or other way ) that you can compare2 arrays - collections that would be valid for an equivalent 3rd array - collection which is a combination of the 1st two.

As an example consider;
* * *
A L E

[code].....

View 17 Replies

Sort Three Arrays (the Other Two Arrays Are In Sync With The First)?

Oct 13, 2009

How can I sort three arrays so they are sorted together (the other two arrays are in sync with the first)?unsorted unsorted unsortedarray1]CODE]....

View 9 Replies

Translating Vbscript String To C# String

Oct 28, 2009

Ok I have a vbscript string in a wsf file as below:

[Code]...

What I need to do is convert this string to a c# string, I understand that a vbscript & translates to a + in c# string concatentation but what does vbCrLf and _ translate to?

View 5 Replies

Class With Dynamic Arrays Inside Another Class Which Also Has Dynamic Arrays?

Nov 15, 2011

Below you will find a code sample that I have dummied up to try and demonstrate the issue I am having. However, this is just a dummied up piece of code. The actual program has noting to do with STUDENTS or TEACHERS. Basically, the problem I'm having is trying to have a CLASS within another CLASS each of which contain ARRAYS that need to be dynamic in size. The sample has a CLASS called STUDENTS that can have in theory many students, the number of which are unknown to the CLASS. I need to be able to add STUDENTS to the ARRAY programmatically.

The CLASSROOM Class should also be an Array since each TEACHER will have MANY Students. There will be only 1 Teacher for a given classroom but the SCHOOL will have MANY CLASSROOMS. Again, I need to programmatically add Teachers and Students without having predefined Array sizes. The code I have listed below will NOT work but it demonstrates what I am trying to achieve. I want to be able to reference the CLASS by using something like this ...

School(iTeacherIndex).Student(iStudentIndex) = "Rick Smith"

I feel like I should be able to use ARRAYLIST in both classes but haven't been able to get it to work. I've tried DIM'ing as ARRAY and can't get that to work either.If I can get ARRAYLIST to work then I shouldn't need to worry about expanding the array via UBOUND (if it's even possible).The REAL question is "How do I have a CLASS within a CLASS, each of which has ARRAYS that need to be dynamic in nature so they can be expanded as needed? The size of the array cannot be determined ahead of time".

REMEMBER . . . the actual program has nothing to do with Students and Teachers. This was just my way of demonstrating the issue using an analogy that I thought everyone could understand. The actual Class is much more involved.I have purposely hardcoded some values just to make the sample easier to work with. This is NOT how I normally program but is just here to hopefully make things a little more clear.

Here is the sample code . . .
'***********************************************************************************
'***********************************************************************************
'***********************************************************************************

'Here is the code that is in the form - This obviously doesn't work

Private Sub TeacherTestDemo()
Dim iTeacherIndex As Byte
Dim iStudentIndex As Byte

[code]....

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved