I'm using Entity Framework code first and pulling some data back from our database. In the table I'm accessing is 13 columns that store the number of a items a customer purchased per week for the last 13 weeks as a char field. I have no control over how this data is stored. I need to total the 13 weeks results together to get a combined total, so take week1 + week2 + week3.... = Total Items Purchased over 13 weeks.In SQL I'd just Cast the char to an Integer and add the values together. But I'm struggling finding a solution to do this in linq.
I tried
(From c in Table
Select New With {.Usage = (Convert.ToInt32(c.week1) +
I have a string I want to parse. I could write the code to do so, but I figured that VS.NET has a parser that should do this for me.however, I can't find it. All the searches I do return info on how to parse numeric values in string form into real numbers. It would be nice if the MSDN search had some ways to allow users to enter more details than just search text and 3 ways to filter out irrelevant stuff. In any case, I also tried things like string.parse (nope - although I kinda figured this would be it.) I also looked at Enum.parse, but the code indicates that it works with arrasy of items, not strings.
I have the following example datatable:[code]And now the user should be able to compare multiple periods. In this example the user chose two periods: 1.1.2010 - 31.12.2010 and 1.1.2011 - 31.12.2011. The result of the example should be:[code]
I'm not sure this is really the right place for this question but I couldn't find a general programming forum.Why are the numeric values -1 and 0 used to represent the logical values TRUE and FALSE?
I want to group items from a linq query under a header, so that for each header I have a list of objects that match the header title. I assumed the solution would be to use ToDictionary to convert the objects, but this allows only one object per "group" (or dictionary key). I assumed I could create the dictionary of type (String, List Of()), but I can't figure out how to write it. As an example I have written a simplified version below.
I found that when group by multiple values does not work well with VB.NET, but it works well with C# ,here are my code, is there something wrong with my VB.NET Code? Here is my VB.NET code:
How to insert and retrive multiple asp.net checkboxes values to MSSQl database as comma seperaed string 1,2,3,4,5 using vb.net ? and retrieve the inserted checkbox chekched in disabled form ..using vb.net url...I want this type of whole layout in vb.net means if user registered selected seats then then next the same page load for todays date the selected seats will be disabled
I have a datagridview with 12 columns and 30 rows I want to use as a scoreboard for a game (no need to input or save data). Columns are for the players and rows for the scores of each turn played. Say player1 has a score of 10 I type it in in his column in row1, the 10 should show up in a label as his total. His next turn his score is 100, type it in row2 and the label should show 110 as total. Hope I am clear enough, is there anyone able to give an idea on how to do this (in code if possible)?
If I have a column say "price" that has for arguments sake 800 rows and I want to use a textbox and button multiply every row by the number entered in the text box when I press the button. So lets say I want to raise the price 8.5% I'd put 0.085 hit the button it would loop through the rows and multiply each value in the "price" column accordingly.
I need to round a single variable up to the nearest integer no matter what the decimal points are, weather it be 74.1 or 74.4 I always need it to round up to 75.ere is a sample of the code i am using
'Varibles Dim sngLength As Single Dim sngWidth As Single
I am using Visual Basic Express 2008.I have added the following code to my text box:
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress If Not IsNumeric(e.KeyChar) Then
if i have 10 textboxes on my form with numbers inside 5 of them have the number "0" other 5 lets say 100 50 40 30 10 i need to get the smallest value but not the "0".
I have a datagridview with 2 columns.What i want is to enter numeric values into 2-nd column and to have the sum of this value in the last row (no matter how many values aka rows i will have). And also how can i have the last row fixed considering further actions.
I have a datagridview with 2 columns.What i want is to enter numeric values into 2-nd column and to have the sum of this value in the last row (no matter how many values aka rows i will have). And also how can i have the last row fixed considering further actions.
I�m using VB.Net 2008 application program.I�m using DataGridView, where column types DataGridViewTextBoxColumn. I have 3 fields. 1 field values are numeric, 1 field values are string and 1 field values are decimal.
When I try to sort the string value column, it sorts correctly. But when i try to sort the numeric value column, it sorts as if its string value.
I�m using VB.Net 2008 application program.I�m using DataGridView, where column types DataGridViewTextBoxColumn. I have 3 fields. 1 field values are numeric, 1 field values are string and 1 field values are decimal.When I try to sort the string value column, it sorts correctly. But when i try to sort the numeric value column, it sorts as if its string value.I searched a lot to make it sort numerically. But I couldn�t find it.
I have a textbox which is bounded to the typed dataset. If the user in the textbox &hit keydown, it should allow only numeric values with 2 decimal points and also it should not allow more than one "."(dot). I found many but all thats are using textbox event
The code below allows me to enter an integer in to the text boxes, but if I enter a decimal in any it throws an error. How do I validate decimal values in addition to integers?
Private Function numeric() As Boolean 'validate text boxes as numeric Dim blnnumeric As Boolean = False
I am trying to read data with a test routine from a fairly simple 3rd party Excel file. The file has three sheets and was created by Open Office 3.x as an 'Excel 97/2000/XP .xls' file. The later, still to be programmed, application must later run on machines with Windows XP Professional using the 2.0 .net framework and no Office package installed. The content of the file does not need to be modified by the later application. For some reason, numeric values are not read correctly. They "convert" to DBNull. I've searched around a bit but not found a 'simple' solution for solving this problem. Adding 'IMEX=1' or 'HDR=Yes;IMEX=1' to the connection string results in an error 'Installierbares ISAM nicht gefunden' (installable ISAM not found).
Based on various examples I've found, I've written the following test code: Option Strict On Option Explicit On Imports System.Data Imports System.Data.OleDb Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click [Code] .....
I am updating an application I've written used by my employer, a University, to allow students to register for their desired residence hall. I'm working on a new feature that will allow students to "partner" with another student - so that when one or the other registers for a room, the other student will be registered as well.
Dim number = TextBox1.Text If number < 1 Or number > 100 Then MessageBox.Show("You must enter a value between 1 and 100", "Name Entry Error", _ MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Exit Sub End If Whenever I enter anything other than a numeric value; the form crashes.
I am looking into data validation as I need a way of setting a textbox to only accept numeric values. I have had a search for this and it doesn't seem as straight forward as I had hoped.
I have found a couple of possible methods, although the sites which I found them where very unclear on how they actually work. I feel strongly that I should know how all of my own programs work >_>
I have no actually got this to work with my program yet. Are there better methods than this?
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress Dim allowedChars As String = "0123456789$,"
I am using VB.Net 2008 application program. I am using DataGridView, where column types DataGridView TextBoxColumn. I have 3 fields. 1 field values are numeric, 1 field values are string and 1 field values are decimal. When I try to sort the string value column, it sorts correctly. But when i try to sort the numeric value column, it sorts as if its string value.
I would like the user to enter positive numbers (decimal or whole numbers but no fraction) using combobox. However the user can only enter the numbers using a number key pad built in the combobox. The number key pad will appear once the user click the down arrow of the combobox (I am not sure if there any predefined feature built into vb.net 2005 that has this property). The number key pad should contain the numbers 0-9 and decimal(.).
In my VB project I need to create a unique string of alphanumeric characters 4 in length from a numeric string 8 in length.This numeric string will always be 8 in length and could range from 00000001 through to 99999999
Public Sub CreateXml() Dim db As New MDataContext Dim Customers = <gallery columns="3" rows="3">
[code]....
Could i mix local values with the ones returned from the LINQ query...Something like the following?
Public Sub CreateXml(ByVal **Col** As String, ByVal **Row** As String) Dim db As New MDataContext Dim Customers = <gallery columns="& **Col** &" rows="& **Row** &">
I am not being able to retrieve from my access database in vb. Here is my code that points to the problem:
[Code]...
The problem I have here seems to me that the comparison between is crop_year =? where ? is the placeholder for Convert.ToInt32(cyrNote.SelectedItem.Trim) which is a value i get from a combobox cyrNote and try to convert it to an integer using Convert.ToInt32() so that it can be compared with the database value crop_year which is defined as integer in the database.
The problem here though is that the select returns null. I tried to replace the placeholder ? with a known value like "2011" and it returned a value. This means to me that my comparison crop_year=Convert.ToInt32(cyrNote.SelectedItem.Trim) is negative yet I expect something positive. I've tried to google on how to convert to integer and that is the best I could get.
When I click on button1, employee_id and P values need to be transferred from button1_click to Cal_Category13() and go through all the calculation. After the calculation, udtnew.X and udtnew.MTD values need to be transferred back to button1_Click
I've no problem to return multiple values Cal_Category13().MTD and Cal_Category13().X from Cal_Category13() to button1_Click but i've no idea how to transfer employee_id and p values from button1_click to Cal_Category13().
Program Code Public Structure PCB Public Employee_ID As String Public MTD As Decimal