C# - ToDecimal From String Not Returning Expected Result?

May 15, 2012

I have the following value 48.81, it comes as a string from the database, I need to convert it to decimal, I'm using:

Dim Seconds As Decimal = Convert.ToDecimal((Coordinate.Substring(4, 5)), CultureInfo.InvariantCulture)

I'm receiving 4881D and I need 48,81

I thought CultureInfo.InvariantCulture was going to help me with that

EDIT:The coordinate value is 675900.244.I'm "spliting" it like this:

Dim Degress As Integer = Coordinate.Substring(0, 2),
Dim Minutes As Integer = Coordinate.Substring(2, 2),
Dim Seconds As Decimal = Convert.ToDecimal((Coordinate.Substring(4, 5)), CultureInfo.InvariantCulture),

[code]....

This is the value of the coordinate in the database?

View 2 Replies


ADVERTISEMENT

Asp.net - Datediff Not Returning Expected Value?

Jun 21, 2012

this code always return '0' i don't know why

Dim cur_month = DatePart(DateInterval.Month, Now).ToString()
Dim cur_date As String = "01/" + cur_month + "/" + (DatePart(DateInterval.Year, Now).ToString)

[Code]....

cnb_mnth is ComboBox for Month

txt_year is Text Box For Entering Year

View 1 Replies

InvokeRequired Keeps Returning False When True Is Expected?

May 24, 2012

I have the following test code. It does nothing useful, but it's there for me to understand VB:

Imports System
Imports System.IO
Imports System.Diagnostics

[code].....

View 1 Replies

Datediff Function Not Getting The Expected Result

Jul 11, 2011

I am using the following code in my project. I want to find the number of days by given the last date and now.[code] for example, when BorrowDate is "01/Jul/2011" then the result is 7 days which it should be 10 to now.

View 1 Replies

Returning Result In Multithreading?

Jan 3, 2010

How do I call a function with System.Threading with parameters and get the return? Normally my code would be:

StrInput = GetString("A")

How can I do this with multi-threading? Is it possible to call this function several times without having to create a new thread each time or a sub that I then run as a seperate thread?

View 16 Replies

Returning Json Result With Object Name MVC?

Oct 28, 2010

When a json result is returned by the controller the object name seems to be missing, I normally wouldn't mind but the flexbox jquery plugin requires the json result in a particular format.

[Code]...

View 2 Replies

SQL Datareader - Returning Result Sets?

Dec 2, 2009

There is a stored proc.. Which was returning to result sets..
Ex:
select * from table1
select * from table2
If I get this data to a Dataset, Definitely I will get 2 data tables with index (0,1)..But what if go though a Datareader? I had checked that just now.. And I got a result of first result set (i.e Table1 in our example)..

View 7 Replies

.net - String Not Printing As Expected

Mar 28, 2011

why the Output window does not print the "xxxxx" part of the string? Looks like I'm missing some basic understanding about something...?

I'm sending string messages over TcpClient, and when building the strings, I don't add any special characters on the sender side, and neither on the receiver side.

[URL]

EDIT:

I'm building my strings at the sender side like this:

Private Sub SendData(ByVal stringArray As String())
SendData(GetMessageString(stringArray))
End Sub
Public Function GetMessageString(ByVal array As String()) As String

[Code]....

View 2 Replies

.Net Code Returning Different Result Than C# Code?

Apr 20, 2012

The following code in C# gives result "228452386"

UInt32 a;
int k = 0;
a = 0x9E3779B9;
a += (UInt32)(url[k + 0] + (url[k + 1] << 8) + (url[k + 2] << 16) + (url[k + 3] << 24));

After above code is ran, "a" contains "228452386" But the following same code in VB.Net results in "Arithmetic operation resulted in an overflow". Basically the last statement is returning value "1868983913" so the runtime error is generated.

Dim a As UInt32
Dim k As Integer = 0
a = &H9E3779B9UI
a += CUInt(AscW(url(k + 0)) + (AscW(url(k + 1)) << 8) + (AscW(url(k + 2)) << 16) + (AscW(url(k + 3)) << 24))

note the variable "url" in above code could be any string and it is same for both codes.

EDIT:When I run the following statements in both C# and VB.Net than they both return same value

C#
(UInt32)(url[k + 0] + (url[k + 1] << 8) + (url[k + 2] << 16) + (url[k + 3] << 24))
VB.Net
CUInt(AscW(url(k + 0)) + (AscW(url(k + 1)) << 8) + (AscW(url(k + 2)) << 16) + (AscW(url(k + 3)) << 24))

Both statements return value "1868983913" for "url" "info:microsoft.com". But when I run complete statement with a += ..then VB.Net gives error while C# returns value "228452386".

View 3 Replies

Why Is String Returning A Char

Jun 27, 2012

I have built a DataTable from my database. Then I am looping through the rows and trying to access a string, however the value is being returned as each character in the string.

For Each theseRows In DisplayForm.MainTab.Rows
If theseRows.Item("Last_Name") = userLast And theseRows.Item("First_Name") = userFirst Then

[Code]....

The Trap_Code values are two or three letter strings, the returned value is each letter once at a time. The loop seems to cycle through the individual characters of the string as an array rather than display the entire value, which is what I was hoping for.

View 2 Replies

VS 2008 Finding And Returning A Value From String?

Sep 21, 2009

G:DevelopmentDOT NET DevColony_4ImagesBattenhallAve_Plan.bmpand i want to find and return the value after the last '' for example in the string above i would want to return:BattenhallAve_Plan.bmp

View 5 Replies

.net: CInt Returning -1 On A (seemingly Valid) String?

Apr 24, 2009

I have a strange problem where CInt (as well as Convert.ToInt32 or even Val) return -1 for a string "500". Using Gurock's SmartInspect for logging, I've checked all values at runtime (SiAuto... logs something, I'm posting the log below the code).

[Code]...

View 2 Replies

WebMethod Not Working When Returning Relatively Large String?

Jul 6, 2010

I am using Virtual Basic with ASP.NET in Visual Studio 2008. I am using Webmethod to communicate from/to the server with the client. Data can be queried and returned in small amount, but when I try get a relatively large amount of data, it's returning me a Server 500 error. My data is 226561 character long, so it's not that large, but it's relatively larger than my other working testing set, which are about 10k character long.

JavaScript:
PageMethods.my_func("context", success);
function success(result, userContext, methodName) {

[code].....

View 2 Replies

Javascript - WebMethod Not Working When Returning Relatively Large String

Dec 9, 2011

I am using Virtual Basic with ASP.NET in Visual Studio 2008. I am using Webmethod to communicate from/to the server with the client. Data can be queried and returned in small amount, but when I try get a relatively large amount of data, it's returning me a Server 500 error. My data is 226561 character long, so it's not that large, but it's relatively larger than my other working testing set, which are about 10k character long.

JavaScript:
PageMethods.my_func("context", success);
function success(result, userContext, methodName) {

[code]....

Is there anything I can change to increase WebMethod returned string length limit? Is there even a length limit or is it some other problem I could not see?

View 1 Replies

Server.htmlDecode() Returning A JSON String From Database

May 2, 2012

I have created a function which essentially enables me to output anything I need from my database in a similar method to Facebook's FQL querying method as a JSON text result. I can also use the same function to get the output as a Dictionary, or List of(Dictionary) to use with VB functions for other purposes.

[Code]...

View 1 Replies

Asp.net - Returning Output Of User Control As HTML Or String With JQuery?

Dec 5, 2011

This morning I was trying to work out how to update a User Control from a button on a page using jQuery.Refresh User Control with jQuery.From the info gleaned from this article: http [url]...I now have a method of loading a User Control as a page with jQuery using the converted .VB example from the codeproject.com article.However... this won't render into the browser, Firebug is giving the error "element must be contained within a form runat=server tag" So I posted this question:

re: better way to manage a dynamic select list using jQuery and User Control.Since posting that though,I have thought about it further, and believe it is the fact that the jQuery Handler class created by the codeproject code is send the browser a complete page.Given that I sadly don't really understand what that codeproject code actually does I am having trouble working out how to alter it.What I need it to do is not return a Page at all, but I guess, an HTML string, which can then be pasted directly as HTML into the div as required.how to alter that code to return an HTML string?

View 1 Replies

Error On Returning List Of String 2008 Desktop Application

Nov 22, 2010

I'm trying to create a ntier desktop application using vb.net 2008.I'm trying this [code]...

View 6 Replies

Error On Returning List Of String Program Desktop Application

Nov 22, 2010

I'm trying to create a ntier desktop application using vb.net 2008.[code]...

By the way what i want to achieve is how to get the data as a List(Of String),because if i put the getMenu function into the presentation layer directly,it gives me the data as i expected..Also if i return as a string instead of List(Of String),it gives me the single data.

View 2 Replies

Parsing A Textbox String And Returning Substrings To Multiple Textboxes

Nov 17, 2010

i've done some basic parsing with text files before.

Scenario is i have 4 textboxes String (which contains the string i'm wanting to parse) sub1, sub2, and sub3. so the string is ex. 500000-1-2

- is the char that is the seperator

so the aim here is to get

500000 into sub1
1 into sub2
2 into sub3

the real string i'm wanting to parse is much more complex, but i'm keeping it simple here for a jumping off point so i can figure the rest out.

View 2 Replies

Calculate Formula In A String To Get Result?

Jul 15, 2011

I have a text box for user key in a formula,like '1+3-5',and i need to solve and display the answer.

Also need to handle the brackets,like '9+(2*4)'.

Operation is plus,minus,multiply,devide.

View 5 Replies

Create A Dynamic String() Result?

Jan 7, 2012

I am trying to create a dynamic string statement[code]...

View 7 Replies

Get String Result To Post In Textbox?

Jul 6, 2009

I need to do is post my results from an IF statment to show up in a text box, but i am not sure [code]...

View 3 Replies

Format A Decimal Result To String Without 0.00 Suffix?

Jul 22, 2010

How can i format a decimal result to a string without the .00 suffix?

View 7 Replies

VS 2008 - Cases - Detect What Is In The String And So Something For Each Different Result

Nov 3, 2009

Im trying to to detect what is in the string and so something for each different result but im not sure howto, here was my first idea but it obviously doesnt work as you cant use contains that way:

Select Case omg.Contains
Case "1"
MsgBox("1")
Case "2"
MsgBox("2")
End Select

View 3 Replies

VS 2008 : Highlight Keyword In String Result In RED?

Jul 27, 2010

I have a keyword search in my program that searches a SQL database table and displays all records that match that keyword in a datagridview. As some of the results can be quiet big i would like to highlight the word in the result that matches the keyword in RED. How can i do this?

Dim count As Integer
Dim word() As String
For count = 0 To DataGridView1.Rows.Count - 2

[code]....

View 3 Replies

Asp.net - Returning In Oracle INSERT Is Not Returning Proper Value?

Mar 15, 2012

I have an ASP.NET web application (VB.NET) using an Oracle database. On an insert, I need to get the identity of the inserted row back. I am trying to use RETURNING, but I keep getting a value of 1 returned.

Dim strInsert As String = "INSERT INTO L.TRANSACTIONS (LOCATION_KEY, TRANS_CREATOR, TRANS_EMAIL, TRANS_PHONE) VALUES (:location_key, :trans_creator, :trans_email, :trans_phone) RETURNING TRANS_ID INTO :ukey"

[Code].....

View 2 Replies

Assign Result (from LINQ To XML Query) To List(Of String)?

Jul 6, 2011

Is it wrong? Please suggest me correct way.

Public Function ReadXML() As List(Of String)
Dim list As New List(Of String)
Dim xmlDoc As XDocument = XDocument.Load("C:\MappingFile.xml")

[code].....

View 1 Replies

.NET Code To Call A Stored Proc And Store The Result In A String?

Oct 5, 2009

What I need to do, is to call a SQL stored procedure from VB.NET, and then store the returned query value in a string.

View 13 Replies

Submit A POST Form And Retrieve Result Page In A String?

May 30, 2011

I am trying to create a program that is able to submit post data for the page [URL] where it submits the request fields and then the resulting page is receiving in a string.

View 2 Replies

Pass An Array Of String When A System.Array Is Expected?

Feb 24, 2009

I am writing an OPC Client in VB.NET (2008) and I am using an OPC wrapper from Graybox. I am having some problems with the data types. I have an Array of String that contains all of the OPC Items that I wish to read from the OPC Server. When I attempt to use the Array of String, Option Strict causes the following compile error message:Error 5 Option Strict On disallows narrowing from type 'System.Array' to type '1-dimensional array of String' in copying the value of 'ByRef' parameter 'ItemIDs' back to the matching argument. How do I pass the Item ID's (all strings) in an array?

View 1 Replies







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