Converting Strings/Numbers?

Feb 23, 2010

when to use what type of conversion? For example when writing a class that would update a record I never know when to use

1. Convert.To...

2. int.Parce(...)

3. (int)....

What is the difference?, when would you use which?

SQL = " UPDATE Search WITH (ROWLOCK) SET "
+ " Keyword = " + (string) OR (Convert.ToString) (Keyword)
+ ",PageRank = " + [code]....

View 3 Replies


Similar Messages:

Web Forms :: How To Add Validation So It Doesn't Accept Empty Strings Or Numbers

Jan 6, 2010

i am using a search box for my application which returns a dataset. however when i click on the search button it returns an empty table result. how could i add validation so it doesnt accept empty strings or numbers.

View 9 Replies

Converting Strings For Mathematical Calculations?

Jul 15, 2010

I'm new to .NET and converting and proper way to convert strings to other values. Specifically, here is a situation I'm facing:

I'm returning two values from a datasource as strings. One values is a representation of a span of time, and another is a count of how many attempts to access a system took place within the span of time.

Given these parameters (for example):

Span of time: 00:01:00
Attempts: 13

I'd like to calculate a third value that shows how many seconds each attempt to connect took place during that span of time. This involves converting the time span to seconds and then dividing by attempts. Where I am getting lost is with the conversion of types. I know the span of time needs to be converted to a date, reduced to seconds, then converted to a number to be divided by the attempts field, also converted to a number.

I've been playing around with code segments like this all morning to no avail:

VBNET Code:
Dim thisTime As String = "00:01:00"
Dim thisAttempts As String = "13"
Label1.Text = thisTime
Label2.Text = thisAttempts
Label3.Text = Math.Round(Integer.Parse(Convert.ToDateTime(Label1.Text)) / Integer.Parse(Label2.Text), 2)

View 2 Replies

SQL Server :: Converting Dates To Strings For Column Names?

Jan 13, 2011

I am working on a query to pull the revenue for the last 7 days, as individual days, to be used in a bar graph. My query does what I want it to:

[Code]....

My question is: How do I change the Date1, Date2, Date3, etc to display the actual date it is pulling from? So instead of Date1, it will say "Jan. 3 2011" and so on...

View 2 Replies

How To Make A UI With A Panel Of Numbers / Highlighted Numbers

Feb 15, 2011

I would like to to make a UI with a panel of numbers, and when hovered above one of them ten the number becomes larger. something like that:

[URL]

I want that when I press a numbers it shows it's value in some other textbox. In which .NET technology is it possible to do it? Windows Forms? WPF? other?

View 6 Replies

How To Compare Strings

May 11, 2010

I want to compare the strings. Its about Disambiguate Doctors profile... If there are four or five members having same name i have to check whether they are same person or not ... If i have smith for five times in my table then i have to check all the five persons like,by having their lastname as comman. check attached form.

Attached Files String Compare1.zip (2.4 KB, 4 views) ThatThatGuy EB Join Date: Jul 2009 Location: INDIA (MUMBAI)
Posts: 424
#2:
May 11 '10

re: How to Compare Strings
String.Equals() will check for same string

View 2 Replies

How To Get Numbers From A String

Jan 28, 2010

i am developing an application using ASP.NET with C#. and SQL SERVER 2005. in my application i have number of strings like:

1. 120 count

2. 60/2.75 oz pkg (2 cookies/pkg)

3. 100/.9 oz.

4. 3.05 oz. patty 105 servings per case

5. 19# average(Catch Weight Item)

6. 2/ 8-9 lb. average weight per case

7. 10#

8. 160 nuggets = 32 servings per case

9. 320/ 1 oz portion (20# Case)

10. 213/2.25 oz. servings (6/5 lb. bags) etc.

from the above strings i have to get only numbers like:

from 1 i have to get 120

from 2 --------- 60/2.75

from 3 ---------- 100/.9

from4 ---------- 3.05

from5 ---------- 19

from 6 --------2/8.9 etc.

how to get the numbers from a string?

View 7 Replies

How To Order The Numbers By Value

Aug 31, 2010

This seems very basic but I can't seem to find a fast way to do it..

I have the following numbers:

5, 3, 10, 52, 1

I want to order them in the correct format from 1 to 52 and be able to point out which one is the highest, which one is the lowest, which one the second to highest, etc.

View 7 Replies

Numbers Appear Outside Of Div Element

Feb 1, 2010

I have a div element which has these css attributes :
HTML

<div class="messageContainer"></div>
CSS
.messageContainer {
margin-left: 2px;
background-color: #F7F5F2;
width: 100%;
min-height: 50px;
border: solid 1px silver;
padding-left: 5px;
margin-top: 3px;
}

When putting this html portion inside the div element : do the things respectively:

<ol>
<li>
Create button control
</li>
<li>
Assign it to the main user
</li>
<li>
Let me know what happened
</li>
</ol>

This is how it shows on the page: (Please look at the numbers) So the question is why this is happening?Why are the numbers are appearing outside of the div element. I used:

.messageContainer ol
{
list-style-position:inside;
margin-left:5px;
}

which worked just fine but now this is what happened.

View 2 Replies

WebMatrix :: Two Numbers After Dot?

Aug 23, 2010

How to do this:

10 becames 10.00

12.3 becames 12.30

14.23 becames 14.23

View 2 Replies

Web Forms :: Quotes In Xml Strings

Aug 26, 2010

I need to post an xml string to another website. I can't create an xml file, because some of the content is dynamically created. The two lines that are causing me problems are

sPostData = sPostData & "<?xml version='1.0'?>"
sPostData = sPostData & "<?qbmsxml version='4.1'?>"

The receiving site expects to see

<?xml version="1.0"?>
<?qbmsxml version="4.1"?>

not

<?xml version='1.0'?>
<?qbmsxml version='4.1'?>

The conversion from double quotes to single quotes isn't being accepted. So how can I send the string so that the versions are surrounded by double quotes?

View 1 Replies

C# - Get Resource Strings From Markup?

Dec 24, 2010

I have an assembly called like X.Common.DLL. There is some resources files for multilanguage app. Let's say it Language.resx Language.en-US.resx....etc.... I have a web application which contains this above dll as reference... So how can I use this resources file in my web applications markup side?

Text="<%$ Resources:Class, ResourceKey %>" is not valid because of "Class" name is in another assembly...

View 2 Replies

Difference Between Strings And Builder?

Jan 4, 2010

What is the difference between strings and string builder in asp.net?

View 3 Replies

Strings Pulled From A Database ?

Jun 18, 2010

Strings pulled from a database formatting issues:

These are pulled from fields in a Database and the results are listed below.

This:recognized as a "Woman in Science" at

Turns into this:recognized as a “Woman in Science†at

This:recently received 2 NIH Director's Awards

Turns into this:recently received 2 NIH Director’s Awards

This:- Director of Communications at acme Communications, Inc

Turns into this:†Director of Communications at acme Communications, Inc.

note:This seems to be not happen when using <ul>
<li> but when it is just enclosed in a <div></div> it

shows the †instead of bullet.How can I fix the display of these strings? This is using C# as the language.

View 7 Replies

Want To Store Strings In Enumerator

May 5, 2010

i want to ask one question can we store strings in enumerator?

View 5 Replies

Localization - .NET: Why Localize Strings

Nov 9, 2010

I'm just getting started using Resharper with VS-2008, and one of the 'errors' it gave me was to localize a Label's text in the code-behind. I've worked with Localization before to Localize a website from english into french, but I don't understand what the benefit is to localizing beside that usage.

View 2 Replies

Working With URL Query Strings In C#?

Jul 25, 2010

I can get the current value of a URL query string by using Request.QueryString["UrlKey"], but can I actually modify the URL with code, without doing a form GET submission?

If the user is landing on the page for the first time, what is the easiest way to programmatically create the ?UrlKey=value through the Page_load method? Or am I better of doing this with Javascript or building a redirect Like: string redirect = "www.mysite.com?" + MyKey + "=" + MyValue;

View 2 Replies

Remove All Text Between 2 Strings?

Jun 24, 2010

i have an entir web page stored in a string variable.I would like to remove all the text between the <head> and </head> tags.How would I do this??

View 2 Replies

C# - Check If Two Strings Are Of The Same Length?

Jan 12, 2010

I want to check if two string are of the same length. I tried the following, but it doesn't work.

string passnew = "1233";
string passcnfrm = "1234";
if((passnew.Length&&passcnfrm.Length)>6 ||(passnew.Length&&passcnfrm.Length)<15)
{
// ...
}

Why does it not work? What do I need to change?

View 6 Replies

Array To Group Of Strings

May 28, 2015

So, I've got an array, filled with data from dynamic input fields. the input fields are PIN, Name and Description... and the user can add as many "sets" of these three fields as they want.

This data goes into an array.

For example, the array may have
11111, Test Name, Test Company
22222, Second Name, Second Company

etc. etc.

I know I can see the values of my array, so if I were to take:
item(0) & ", " & item(1) & ", " & item(2)

my output would be:
11111, Test Name, Test Company

The problem I'm having, is, I need to write ALL of the groupings of three out to a file... and I'm stuck on how to do that. So, I need a way to loop through until the end of the array and get:

item(0) & ", " & item(1) & ", " & item(2)
(enter a line break)
item(3) & ", " & item(4) & ", " & item(5)
...

until the end of the array

I'm guessing I need a for-loop and a counter, but can't get the syntax correct.

View 1 Replies

Session State With Numbers?

Jan 12, 2011

This example works great with string variables in ASP.Net:

Session("Stocks") = "MSFT; VRSN; GE"
On a different aspx page:
Dim StockString() as String = Session("Stocks").ToString.Split(";")
for i as integer=0 to StockString.GetUpperBound(0)
dim x as string = StockString(i)
next i

But...I cannot determine how to take a number (as in val(txtNumber.text) and make it available on a different page.

View 5 Replies

Add Numbers To Labels Before Rendering

May 24, 2010

In my webpage i use the following in order filling the listview control

<asp:ListView ID="ListView1" runat="server">
<layouttemplate>
<asp:PlaceHolder id="itemPlaceholder" runat="server" /></layouttemplate>
<ItemTemplate>
<tr>
<td><asp:Label ID="Label1" runat="server" Text = '<%# DataBinder.Eval(Container.DataItem, "Ans1") %>' Visible = '<%# DataBinder.Eval(Container.DataItem, "Ans1Visible") %>'></asp:Label>
<br />
<asp:Label ID="Label2" runat="server" Text = '<%# DataBinder.Eval(Container.DataItem, "Ans2") %>' Visible = '<%# DataBinder.Eval(Container.DataItem, "Ans2Visible") %>'></asp:Label>
<br />
<asp:Label ID="Label3" runat="server" Text = '<%# DataBinder.Eval(Container.DataItem, "Ans3") %>' Visible = '<%# DataBinder.Eval(Container.DataItem, "Ans3Visible") %>'></asp:Label>
<br />
<asp:Label ID="Label4" runat="server" Text = '<%# DataBinder.Eval(Container.DataItem, "Ans4") %>' Visible = '<%# DataBinder.Eval(Container.DataItem, "Ans4Visible") %>'></asp:Label>
<br />
<asp:Label ID="Label5" runat="server" Text = '<%# DataBinder.Eval(Container.DataItem, "Ans5") %>' Visible = '<%# DataBinder.Eval(Container.DataItem, "Ans5Visible") %>'></asp:Label>
<br />
<asp:Label ID="Label6" runat="server" Text = '<%# DataBinder.Eval(Container.DataItem, "Ans6") %>' Visible = '<%# DataBinder.Eval(Container.DataItem, "Ans6Visible") %>'></asp:Label>
</td>
</tr>
</ItemTemplate>
</asp:ListView>

Now i would like to add numbers to the labels before they are rendered. For example currently the data displayed are like

Tennis
Football
Basketball
Nfl
Nba
Polo

and the output i would like to have is

1. Tennis
2. Football
3. Basketball
4. Nfl
5. Nba
6. Polo

Could i use ListView1_ItemCreated or the ListView1_ItemDataBound event to achieve this? If that is true, could you point me a place to start? the list view is filled with

Dt = GetDataTable("SELECT Ans1, Ans2,Ans3,Ans4,Ans5,Ans6, Ans1Visible,Ans2Visible,Ans3Visible,Ans4Visible,Ans5Visible,Ans6Visible, From myTable WHERE CatID ='" & cat & "'")
ListView1.DataSource = Dt
ListView1.DataBind()

View 4 Replies

Regex To Extract Numbers?

Jul 27, 2010

i'm looking for a regex that does the ffg:

string1 = Test1234

string2 = Test9999

i want the regex to return 1234 and 9999 if the string starts with Test.

View 3 Replies

Localization :: Changes Numbers All To English In IE8?

Jan 10, 2010

I am developing a site in Persian (it a right to left language), and it's supposed to be used both with IE7 and IE8. I don't have any problems with IE7 but in IE8 all my numbers show in English instead of Persian; ie instead of showing ١٢٣ , IE8 shows 123. I tested Culture and UICulture but they didn't solve the problem.

By a great chance, I found that if I Omit "DocType" tag from top of my pages this problem resolves, but some other problems appear like my Ajax popup dialog box won't work as it used to in both IE7 and IE8; I've also seen warnings that say CSS Styles may not work properly without "DocType" tag.

What's wrong with <!DocType>? And How can I solve my problem?

View 3 Replies

.net - Validation On Telephone Numbers?

Mar 8, 2010

in my application i want to validate the telephone numbers, how can i write regular expression for telephone numbers like..

040-23357399 or 04023357399
91-40-23357399 or 914023357399
08518-2814655 or 085182814655
91-8518-2814655 or 9185182814655

this is my phone numbers how can i write the expression for this

View 2 Replies







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