Create An Application That Allows User To Type In A 32 Bit Number Using Binary System

Jul 13, 2011

Can anyone help me to break down the instructions for this assignment.Create an application that allows the user to type in a 32 bit number using the binary system, and convert that number into the decimal numbering system.For example, the user types 000000000000 0010 (where there are 30 leading 0's, 1 then 0 from left to right), and the output would be 2.The user will type a string that is 32 characters in length.A For loop 'reads' each character using the x.substring(i,1) where i is the current character we are reading and 1 means one character only,and x is the entry the user typed (use a Textbox to get the entry but Inputbox is also ok).When you start at the first character (from the right) then that value is to be * 2 ^ 0 then the second character is to be * 2 ^ 1, then the third character is * 2 ^ 2, hence:( x.substring(i,1) converted to Integer ) * 2 ^ j represents the decimal value of the current number (0 or 1) we are reading.A variable is needed to accumulate all those values.After the loop is done, display the accumulated value.To test this code on a simple version, enter a 4 digit binary number, where 0010 is decimal 2, 0110 is decimal 6, 0111 is 7, and 1000 is 8.

My understanding is the user must enter 32 digits into a textbox. The textbox should place limitations that only allow the digits "0" and "1". This error could be displayed to the user with a messagebox that then asks to reset the value orginally inputted into the textbox. My understanding is I should continue creating the formula of the position of each character where the third character is *2^2, fourth is *2^3, fifth is *2^4 and so on? I don't understand the formula and how it works.

View 9 Replies


ADVERTISEMENT

Create A Program Where The User Will Type In A Number?

Nov 15, 2011

im trying to create a program where the user will type in a number then choose the units its in and units it will be converted to from 2 comboboxes. The output should be changing as different units are clicked without a button.

Public Class Convert
Sub Calculate()
Dim Unit1 As Double = (ComboBox1.SelectedItem)

[Code].....

View 2 Replies

Create An Application That Prompts The User For A Number Less Than 100?

Nov 16, 2011

-Create an application that prompts the user for a number less than 100 and then when the button [Check Number' is clicked - displays whether the number is one digit or two digits.

View 6 Replies

Create A Small Application That Will Force User To Enter An Even Number?

Oct 5, 2011

I need to create a small application that will force a user to enter an even number but i MUST use a loop. Here's what i've come up with:

Quote:

Dim bynombrepair As Byte
bynombrepair = InputBox("Entrez un nombre pair")
If bynombrepair Mod 2 = 0 Then

[Code]....

View 1 Replies

Create An Application That Allows User To Enter Number Of Tickets Sold

Apr 16, 2012

i'm having a bit of a hard time on setting up the calculations.There are three seating categories at a stadium. For a baseball game, Class A seats cost $15, Class B seats cost $12, and Class C seats cost $9. Create an application that allows the user to enter the number of tickets sold for each class and the total revenue.

View 3 Replies

VS 2010 Create Application's User Login System?

Dec 7, 2009

[Code]...

I need some trick to make some good and safe "Login" to application system with username and password.

View 8 Replies

Create A Notification System For Application That Will Alert The User Once New Items Have Been Sent To Their Queue?

Jul 4, 2010

I need to create a notification system for my application that will alert the user once new items have been sent to their queue, which is made of up database entries. The latter part of this question may need to be asked in the database forum, but I guess we'll figure that out First, since I haven't created anything like this before, I need some direction on what the best possible solution would be.The notification system should always be running and work independently of the main app. With this requirement, I thought a Windows Service would be best.

The notification itself will just be a quick form that alerts the user. I'm sure most of that will be fairly easy to create. The only issue I'm wondering about is how to constantly check the database and determine a new record has been inserted.Would a windows service have a timer or something that allows me to constantly check?If it does, how would I determine a new record has been inserted?

View 4 Replies

Asp.net - .Net Iniatialising A Class Using System.Reflection And System.Type To Create A Session Based Singlton Extension Method

Jun 11, 2009

I have had several occasions recently to access a specific class several times over a relatively small time frame.So I've been storing the value of the class in Session and trying to access it on page load, if it's not available creating a new instance and storing that in session.

So instead of constantly replicating the same code for different classes on different pages I'm trying to create an extension method to do this for me.

[Code]...

I'm stuck on what to do when I make my new instance of my class (it would have to have a New() sub)

I'm not sure where to go from here... or even if this is the best way to do it.

View 2 Replies

Unable To Cast Object Of Type 'System.IO.FileStream' To Type 'Excel.Application'

Jun 1, 2009

I'm having a problem with converting from one source type to a destination type. I have a form with 2 buttons (button 2 uses the OpenFileDialog to have the user open an excel file set to NewFile),(button 1 takes the contents from specific cells in NewFile and arranges them how I need into oXLApp1).

The error I get is "Unable to cast object of type 'System.IO.FileStream' to type 'Excel.Application'." in line 14 of the code below.

Public Class Form1
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

[Code]....

View 4 Replies

Event Type Clr20r3 P3 4a5c12c0 System.net.sockets.socket Exception And Application Crash On Some System While Running Well On Others

Aug 3, 2009

Event type clr20r3 p3 4a5c12c0 system.net.sockets.socket Exception and Application crash on some system. while running well on others. i go thorugh many forms and search a lot on google but not able to resolve the issue.

[Code]...

View 1 Replies

Byte() (System.Byte[]) Versus Binary (System.Data.Linq.Binary)?

May 1, 2009

i have a table in sql server with some fields set as Byte() (System.Byte[]) when i import them in my application to be used with linq they are converted in Binary (System.Data.Linq.Binary)why is that?is there a way to prevent this wrong translaton???if i update the database how can i update the classes that has been craeted in visual studio2008?

View 2 Replies

VS 2005 - Login System - Application Which Has User Authentication System

Apr 1, 2009

I'm writing an application which has user authentication system, basically, when the user open the software, he has to enter his/hers username and password which are retrieved form a access data base, and if the user is set as admin then it enable some features, I couldn't figure out how to read the column lets say, IsAdmin table, which will store an value of 1 or 0 for example. I need a concept of how build a login system with levels or whatever you guys call it...

View 2 Replies

Login System With User Type?

Apr 24, 2012

I created a Login system using the Login Form from VB 2010 and connectected to a DB table called "Useri" with 4 columns: "ID_U" , "UserName" , "Password" , "UserType". The login form works to authentificate user, and my application starts. My app has 5 buttons and i want them to be restricted by user type

If admin - full acces

if Operator - 1 button(that leads to a form with 4 textboxes that edit a row from a database)

if guest - 1 button that leads to a form with a datagrid

So, if a guest user clicked a resticted button a msgbox appears.

My login form code looks like this.

[Code]...

View 5 Replies

IDE :: Allow The User To Only Type In A Certain Number Of Characters In A Datagridview Column?

Apr 14, 2006

Is there a way to allow the user to only type in a certain number of characters in a datagridview column? Like a invoice number can only be 1-6 digits long and I want to stop them from typing more than 6 digits.

View 7 Replies

IDE :: DataGridView1_CellLeave(sender, New System.EventArgs), Unable To Cast Object Of Type 'System.EventArgs' To Type 'System.Windows.Forms.DataGridViewCellEventArgs'.

Jun 27, 2011

VB 2008, DataGridView,DataGridView1_CellLeave(sender, New System.EventArgs)

"Unable to cast object of type 'System.EventArgs' to type 'System.Windows.Forms.DataGridViewCellEventArgs'."

What is the Correct String for "New System.EventsArgs"

Anybody there is to help me out.

View 1 Replies

.net - Create A New System.String Type With Other Name?

Jun 23, 2011

I try to describe my problem step by step because I do not know how to say it in correct programming terms.

When I use a System.String type, I do the following:

Declare the type: Dim Str1 as String
Assign its value: Str1 = "This is a string"

I want to create a new type that just like the System.String type but in different name. For example, I want to create a UrlString type for string like this:

Declare the type: Dim Str2 as UrlString
Assign its value: Str2 = "http://www.example.com"

My question is: How do I create the UrlString type?

The reason: I want to create the UrlString type to help me to identify the value of the content. For example, UrlString type means the string is in url format, PhoneString means the string is in phone format, CreditCardString type means the string is in credit card format and so on.

Class UrlString
Private ReadOnly value As String
Public Sub New(ByVal value As String)

[Code].....

View 1 Replies

Error - An Exception Of Type 'System.InvalidCastException' Occurred In FFK.DLL But Was Not Handled In User

Mar 16, 2009

I have used the Gridview_PageIndexChanging event in asp.net.i have used the code like this:

gridFileDetails.PageIndex = e.NewPageIndex

During the run time when i clicked the next page,it generates an error:

An exception of type 'System.InvalidCastException' occurred in FFK.DLL but was not handled in user

code

Additional information: Unable to cast
object of type
'System.Web.UI.WebControls.ContentPlaceHolder'
to type
'System.Web.UI.WebControls.GridViewRow'.

in the RowCommand event,I have used the following RowCommand event:

Protected Sub gridFileDetails_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles gridFileDetails.RowCommand
Dim row As GridViewRow = CType(CType(e.CommandSource, Control).NamingContainer, GridViewRow)

[code]....

View 3 Replies

Unable To Cast Object Of Type 'System.Collections.Generic.List`1[System.Int32]' To Type 'crmWebService.ArrayOfInt'?

May 14, 2012

I'm getting an error after sending a list to a web service.This is the code that is calling the web service:

Dim sProgramInterest As New List(Of Integer)
crmService.InsertProspectGetId(sProgramInterest.ToList)
But I'm getting this error.

[code].....

View 3 Replies

VS 2010 Unable To Cast Object Of Type 'System.Windows.Forms.MouseEventArgs' To Type 'System.ComponentModel.RunWorkerCompletedEventArgs'

Jun 25, 2010

My project worked a first and now its giving me a problem.The error

Quote:

Unable to cast object of type 'System.Windows.Forms.MouseEventArgs' to type 'System.ComponentModel.RunWorkerCompletedEventArgs'.

View 2 Replies

Convert Decimal Number To Binary Number With Fixed Bits?

Oct 29, 2010

I want to convert numbers from 0 to 15 like that

[Code]...

Problem is that when we convert 2 to binary number it gives only 10 in binary, but i want to convert 2 to 4 bit binary number 0010.

View 1 Replies

Error : Unable To Cast Object Of Type 'System.EventArgs' To Type 'System.Windows.Forms.KeyPressEventArgs'

May 16, 2011

[URL]The issue is as soon as I change the value of the text boxes it gives me an error and forces me to close the project.

The error is:Unable to cast object of type 'System.EventArgs' to type 'System.Windows.Forms.KeyPressEventArgs'.

However I'm supposed to clear the number of gallons used and the total charged when a change is made to the contents of the 2 text boxes on the form.

View 3 Replies

Error Unable To Cast Object Of Type 'System.Data.SqlTypes.SqlDecimal' To Type 'System.IConvertible'

Jun 6, 2011

I have an InvalidCastException Error in my program. The program is that i try to insert an employee record into a database table after getting the details from a form. I've used Money data type is SQL Server for salary and SqlTypes.SqlDecimal data type in employee template class. i've used a stored procedure to pass the values and i add the basic value by passing a parameter by the method

Dim prm8 As SqlParameter = com.Parameters.Add("@basic", SqlDbType.Money)
prm8.Direction = ParameterDirection.Input
prm8.Value = emp.Bsc

I've used the money datatype itself even in the stored procedure variable.I get the following error.

failed to convert parameter value from sql decimal to decimal
Even if i use
prm8.Value = Convert.ToDecimal(emp.Bsc)

I get an error Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible'.

View 3 Replies

Forms :: Display Picture In Picturebox1 - Shows This Message, Unable To Cast Object Of Type 'System.DBNull' To Type 'System.Byte[]'?

Dec 24, 2009

Now I want to display picture in picturebox1.To do this I use this codes, but it does not display picture

on this line: Dim arrPicture() As Byte = CType(dt2.Rows(0)("img_path"), Byte())

it shows this message,

Unable to cast object of type 'System.DBNull' to type 'System.Byte[]'.[code]......

View 1 Replies

Ado.net Error (Unable To Cast Object Of Type 'System.String' To Type 'System.Data.IDataReader'.)?

Jan 29, 2012

I am getting this error when I am tring to load string type to data table)

Using connection As New SqlConnection("connectionstring;")
connection.Open()
Using Command As New SqlCommand("SELECT ClientId,forename,surname from t_clientdetails

[code].....

View 1 Replies

ASP.Net Error - Unable To Cast Object Of Type 'System.String' To Type 'System.Data.DataTable'

Oct 4, 2009

I get the below error Unable to cast object of type 'System.String' to type 'System.Data.DataTable'.This is the code I'm using

Dim str As String = String.Empty
If (Session("Brief") IsNot Nothing) Then
Dim dt As DataTable = Session("Brief")
If (dt.Rows.Count > 0) Then

[code]....

View 3 Replies

Unable To Cast Object Of Type 'System.String' To Type 'System.Windows.Forms.TextBox'

Jun 12, 2011

Unable to cast object of type 'System.String' to type 'System.Windows.Forms.TextBox'.

View 12 Replies

Create/Add New User To The System?

Nov 26, 2011

I have a problem in adding/creating a new user to the system. The data entered didn't successfully inserted into database. It didn't show any errors too.

Protected Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
Dim cmdInsert As OleDbCommand
Dim strInsert As String

[code]...

View 1 Replies

Asp.net - Unable To Cast Object Of Type 'System.Web.UI.WebControls.Label' To Type 'System.IConvertible'

May 2, 2012

I'm creating a student evaluation form in a repeater that should submit the evaluation responses and update the SQL database, but I keep getting the error mentioned in the title. I'm coding in ASP.Net using VB.

Here's my code:

Student.aspx
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="Server">

[Code].....

View 1 Replies

LINQ To SQL: Unable To Cast Object Of Type 'System.Guid' To Type 'System.String'

Nov 15, 2011

I am getting a really bizarre error and it makes no sense at all.Basically I have a user entity which has a Password property. This property is of Type Binary, the server data type being Binary(512).I am reading this value in and converting it to a byte array. However whenever I run my code I am getting a completely unrelated error of Unable to cast object of type 'System.Guid' to type 'System.String'.This strikes me as very odd since I am not using a property or variable of type string or GUID anywhere in this procedure where it falls over.

The code is below:

Public Shared Function ValidateUser(ByVal username As String, ByVal password As String) As UserValidationMessage
Using db As New EntityMapDataContext
Dim u = From user In db.Users
Where user.Username = username

[code]....

View 3 Replies

Unable To Cast COM Object Of Type 'System.__ComObject' To Class Type 'System.Xml.XmlNode'

Jul 30, 2009

Code: Dim dom As New DOMDocument30 dom.async = False
dom.Load(serverAddress & "/App/filelist.jsp?type=content")
For i = 0 To dom.childNodes.item(1).childNodes.length - 1 downloadfile(dom.childNodes.item(i), mcount, currentpath) Next

The above code is activated upon clicking of a button. i have the server address declared. and using the domdoc to load the jsp file to generate the xml data. and using for loop, i call the download file function which accepts the following parameters

Code:Public Sub downloadfile(ByVal domdoc As Xml.XmlNode, ByVal totalcount As Integer, ByVal currentpath As String)

The totalcount and currentpath work fine, but when i pass in the dom.childNodes.item(i) , error pops up.

--------------------error message------------------------------------------Unable to cast COM object of type 'System.__ComObject' to class type 'System.Xml.XmlNode'. Instances of types that represent COM components cannot be cast to types that do not represent COM components; however they can be cast to interfaces as long as the underlying COM component supports QueryInterface calls for the IID of the interface.-------------------------------------------------------------------------------

[code]....

View 1 Replies







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