|
Hello,
I am designing an accounts webform( Crikey! ) in which I have two fields 'rate' in textbox1 and 'points' in textbox2 which are of type decimal in the first half of the webform. The user enters the values in these text boxes from the webform and on hitting a button 'calculate & display' following things should happen:
1. In textbox3 - result (type decimal) it should display the result (rate)-(points) which I have achieved
2. the user then enters the rest of the form and hits 'save form'. which means i have two buttons on the form,'calculate&display' and 'save'
3. On hitting save, it should save all the values on the webform into my (SQL server) database --- this is not working, it saves all of the other fields except these 3 text box values i.e. 'rate', 'points' and 'result', all that the database is saving each time is '0.00000' and '1.00000'
can someone please help me with this ... cansome give me a quickie tour of how to calculate values on webform , display the result and save the rsult in database because i need to do a lot of this in the rest of the form. I have 6 more fields which I need to compare, calculate,display and save in database !!!
I use Vb.net code but C# is welcome too.
Thanks a Zillion in advance...it is going to be big help!!!
Aartee.
...HE is watching Us All!
|
|
|
|
|
have you tried changing the type of ur results?
Aim small, miss small...
|
|
|
|
|
Hi tatchung,
I don't quite understand what exactly you mean by changing the type of results but everything is in decimal...even if i try it in type Int or varchar etc... it still does not work, it is calculating and displaying the correct subtracted values but only on the webform, not saving it in the database.
Aartee.
...HE is watching Us All!
-- modified at 22:26 Sunday 18th September, 2005
|
|
|
|
|
Good day sir,
I mean have you tried checking the value u are returning in ur insert command? is it of type decimal? i've had a similar problem with a short once and all i did was declared the value in my insert command. might work on ur problem but then again i could be wrong...im still a beginer u know
Aim small, miss small...
|
|
|
|
|
all that the database is saving each time is '0.00000' and '1.00000'
You might have referenced the wrong control, or you are losing the control handle on postback of the page.
If you can give a small sample code containing your Textboxes and Database update we might be able to help you more on this.
Ed
-- modified at 3:03 Monday 19th September, 2005
[Edit]Also, posting in ASP.Net forum might be better.[/Edit]
|
|
|
|
|
Can anyone help with this one
Have a form with a listbox and 5 textboxes, by clicking the different customer id's in the listbox this then displays the relevant info in the textboxes which is first name, last name, city, state and zip code from the Customers Table, this works fine but I'm trying to display at the same time the orders placed for each selected customerid only in a datagrid from the Orders Table but can't get it to work
The orders placed details to be displayed in the datagrid from the database are OrderID, OrderPrice and CustomerID, have tried to include a data relation but being new to programming not sure if it's right, or which is the correct datasource to use for the datagrid
I also need to show when the form initially loads the info for the first CustomerID by default
Any advice/coding which could help me would be much appreciated, my coding is below
Many thanks
Imports System.Data.OleDb
Imports System.IO
Public Class Form1
Inherits System.Windows.Forms.Form
Dim ds As DataSet
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Declares and instantiates command object
Dim SqlCustomers As String = "SELECT * FROM customers"
'Sets the connection string
Dim connString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\The Doughnut Shop.mdb"
'Declares and instantiates a new OleDbconnection object
Dim myconnection As OleDbConnection = New OleDbConnection(connString)
' Sets the connection string property
myconnection.ConnectionString = connString
'Declares and instantiates a data adapter
Dim dacustomers As OleDbDataAdapter = New OleDbDataAdapter(SqlCustomers, myconnection)
ds = New DataSet
dacustomers.Fill(ds, "customers")
Dim sqlorders As String = "Select OrderID, OrderPrice, CustomerID from Orders"
' Declares and instantiates the datadapter
Dim daorders As OleDbDataAdapter = New OleDbDataAdapter(sqlorders, myconnection)
daorders.Fill(ds, "orders")
Dim relation As DataRelation = New DataRelation("CustomersOrders", ds.Tables("Customers").Columns("CustomerID"), ds.Tables("Orders").Columns("CustomerID"))
ds.Relations.Add(relation)
ListBox1.DisplayMember = "CustomerID"
ListBox1.DataSource = New DataView(ds.Tables("customers"))
TextBox1.Text = ds.Tables("customers").Rows(0).Item("FirstName")
TextBox2.Text = ds.Tables("customers").Rows(0).Item("LastName")
TextBox3.Text = ds.Tables("customers").Rows(0).Item("City")
TextBox4.Text = ds.Tables("customers").Rows(0).Item("State")
TextBox5.Text = ds.Tables("customers").Rows(0).Item("ZipCode")
End Sub
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
Dim drv As DataRowView = CType(ListBox1.SelectedItem, DataRowView)
Dim childRows() As DataRow = drv.Row.GetChildRows("CustomersOrders")
TextBox1.Text = drv("FirstName")
TextBox2.Text = drv("LastName")
TextBox3.Text = drv("City")
TextBox4.Text = drv("State")
TextBox5.Text = drv("ZipCode")
DataGrid1.DataSource = childRows
DataGrid1.Refresh()
End Sub
End Class
|
|
|
|
|
SLG7 wrote:
at the same time the orders placed for each selected customerid only in a datagrid from the Orders Table but can't get it to work
Is it displaying all of the customers or nothing at all?
|
|
|
|
|
There's nothing showing in the datagrid for the Orders Table
Been racking my brains over this one any help/coding would be great
Thanks
|
|
|
|
|
Hi there!
I'm trying to control a program with a gamepad.
Does anybody know how to initialize a joystick or gamepad using DirectInput and make the joystick inputs usable?
Thanks
|
|
|
|
|
The samples that come with DirectX show you how.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I can only find C++, is there any VB.Net code as well?
|
|
|
|
|
Did you install managed C++ ? It doesn't install automatically, it needs a command line switch. Then you should have C#/VB.NET samples.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I have C++ and Managed in the DirectX SDK folder. In managed I only find C# samples and no VB.NET.
|
|
|
|
|
There are no VB.NET samples in the DirectX SDK anymore. For some reason they have dropped support for VB.NET. This is now way means that you can't use VB.NET with DirectX, there just no documentation support for it. Use the C# examples and translate the code. Much of C#'s syntax maps almost directly to VB.NET statements.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Well that aswers my question why I could't find anything on the internet, not happy with it though!
You don't have any code on this by any chance? I'm unfamiliar with C#. Will try it anyway.
Thanks for your help.
|
|
|
|
|
Jerry___ wrote:
not happy with it though!
Neither are the people on the DirectX team at Microsoft.
Jerry___ wrote:
You don't have any code on this by any chance?
Nope.
Jerry___ wrote:
I'm unfamiliar with C#. Will try it anyway.
If you know VB.NET, you know more about C# than you think. If you look at the MSDN documentation, there are thousands of code samples for everything in the .NET Framework, written in both VB.NET and C#. There's your Rosetta Stone. You don't need examples written speciffically in VB.NET to learn about the .NET Framework and DirectX. The managed objects are the same between them because they're using the exact same objects. There isn't a VB.NET version and a C# version. All you have to do is compare any VB.NET samples to the C# samples (MSDN example code supplies both for neearly every in the docs) and take note of what each line does and compare it to the other languages equivilent. It's pretty easy.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-- modified at 11:16 Monday 19th September, 2005
|
|
|
|
|
Hello again,
I'm allmost done. the program works just like the C# one.
Still one problem, need to translate this to VB.Net:
byte[] buttons = state.GetButtons();<br />
<br />
int button = 0;<br />
foreach (byte b in buttons)<br />
{<br />
if (0!= (b & 0x80))<br />
strText += button.ToString("00 ");<br />
button++;<br />
}<br />
labelButtons.Text = strText;<br />
}
Cant figure out the 0x80 part, and cant find it anywhere either, not even in the help section.
I suppose ("00 ") is a format.
The rest works just fine; you were absolutely right about knowing more about C# than you think!
|
|
|
|
|
All problems solved!
App up and running, fully functional, exactly the same as in the C# example. Very pleased.
If anybody needs it, let me know.
Thanks again.
|
|
|
|
|
I have a mother form and two child forms. How can I properly code VB.NET to show (make it appear) the second form still recognized as "child" form of the mother though what I've clicked is the active child form's button? For instance, I have one active child and I click its button and another child form appears. How can I "tell" this second form that it is a child not of the one who called it but of the mother form? Thanks...
|
|
|
|
|
Creation of child forms should really be left up to the parent form. But,
Dim newChild As New myForm2()
newChild.MdiParent = Me.MdiParent
newChild.Show()
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I need to establish a connection between one PC and a PocketPC.
Someone can guide me about how can I start?
Thanks
|
|
|
|
|
|
Thanks a lot!
Very useful links!!
|
|
|
|
|
Any one can make it?
I make form opaque and transparent doing
setstyle(controls.transprant,true)
setstyle(controls.opaque,true)
and
me.backcolor=color.transprant
it i make ellispe in form it looks like rounded firm
but if i move that form it have backgroud . it is not transprant form
How can i make permanent rounded form and round button?
Anyone can help me?
|
|
|
|
|
Do ANYONE know anything about this? I have searched hours upon hours this last week to see if anyone can acurrately answer my questions on this topic. I have been trying to get the extended properties for VB.NET 2003 ListView to work. Am I at least on the right track with:
Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" ( _
ByVal hwnd As Int32, _
ByVal wMsg As Int32, _
ByVal wParam As Int32, _
ByVal lParam As Int32) As Int32
Const LVM_GETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + &H37
Const LVM_SETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + &H36
Const LVS_EX_UNDERLINEHOT As Int32 = &H800
* Note I have several if not all other LVM and LVS_EX constants declared
Some of them work, some of them don't but I am throwing them all into this function call:
SendMessage(ListView1.Handle.ToInt32, Me.LVM_SETEXTENDEDLISTVIEWSTYLE, 0, Me.LVS_EX_UNDERLINEHOT)
*I have even tried Listview1.update() after this call - I realize the one click or two click activate must be enabled in conjunction with this for it to work and have done so via the properties option of the control as well as "Or"ing it with LVS_EX_ONECLICKACTIVATE, still no dice.
Still the Hot items do not get underlined. However if I try
SendMessage(ListView1.Handle.ToInt32, Me.LVM_SETEXTENDEDLISTVIEWSTYLE, 0, Me.LVS_EX_ONECLICKACTIVATE)
The icon changes to a hand (finger pointing) and it seems as though the message is succesfull.
WHY DOES THIS WORK ON SOME AND NOT ON OTHERS!?!?
*Also before you ask, I am aware of the GETEXTENDEDSTYLES and assigning it to a variable and then "Or"'ing it into conjunction with other constants as to not turn off all other extended styles and what not. NOBODY SEEMS TO KNOW ANYTHING ABOUT THE EXTENDED STYLES OF LISTVIEWS AND/OR HOW TO SUCCESSFULLY USE THEM IN VB.NET - WHY IS THE API SUCH A TRICKY SUBJECT THAT HARDLY ANYONE KNOWS ANYTHING ABOUT AND WHY DOES MICROSOFT MAKE GETTING THAT INFORMATION SO HARD?
PLEASE SOMEBODY HELP ME!!!
*If you want to have an idea of what I am trying to do here I posted a question on stopping the ListView from flickering in the VB.NET postings about a week ago. My final objective is to successfully get the LVS_EX_DOUBLEBUFFER to work. PLEASE HELP ME!!!!
|
|
|
|