|
i have one datatable contains price column
i need to calculate the sum of the prices
and then delete all the rows from the table
my code is :
dim total as decimal
total=dataset.tables("sourcetable").columns("price").experssion="sum(price)"
but when the code executed it generate exception
can not use experssion in an circual function
second:
i need to know how to delete all rows from datatable at run time
regards to all
|
|
|
|
|
don't know about the first question but for the second:
dataset.tables("sourcetable").clear
(I didn't test it but it should work)
about the first question if you have a db backhand why not do that in sql?? (just a suggestion)
|
|
|
|
|
the clear method clears the dataset table only and when i call update method nothing happen
i know that i can get sum from SQL and use stored procedure to execute the statments
but i need to di it through VB experssion method
thanks for help
-- modified at 6:17 Tuesday 17th July, 2007
|
|
|
|
|
What you did was try to put the expression in the column, which won't work. You have to enumerate the rows in the table, adding up the prices, and you can also delete each row in the datatable, then call the update method on the dataadapter for this datatable/dataset to write the changes back to the database.
|
|
|
|
|
i want to buy a book for vb.net 2005 anybody can suggest book for both(beginners and also for high level) tell separate book also
sathish
|
|
|
|
|
(1) Pro-ASP.NET 2.0 in VB 2005 by Laurence Moroney, edited by Matthew MacDonald by apress publication
(2)ASP.NET 2.0 Web Programming with VB 2005 by Murach Publication.
(3)Professional VB 2005 by Bill Evjen, Billy Hollis, Rockford Lhotka, Tim McCarthy, Rama Ramachandran, Kent Sharkey, Bill Sheldon by wrox publication.
Regards,
Satips.
Don't walk in front of me, I may not follow;
Don't walk behind me, I may not lead;
Walk beside me, and just be my friend. - Albert Camus
|
|
|
|
|
Use Microsoft Press Book
or
WROX books VS2005 is also one of the useful book
regards,
koolprasad2003
Be a good listener...Because Opprtunity knoughts softly...N-Joy
|
|
|
|
|
Hi,
Currently I am working on a multilingual application.
1. I willing provide a Button on UI which will toggle IME mode, say from English to Japanese. How can do that ?
2. How can I detect if systems IME mode is changed by user ?
3. As well as above I want to transliterate the inputed text to english. Can I do it ?
Regards
Prasad
|
|
|
|
|
|
Thanx for ur efforts Dragon,
but it didn't helped me. What u have given dosent carries information about how .NET handles IME things. Thanx allot.
Prasad
|
|
|
|
|
Hello, I encounter strange phenomenon with my listview and smallimages. The images disappear and don't come back, even after reboot, run the application on a different machine. If i create a new listview, it works again for a while. Does anyone can help me with this annoying thing.
The imagelist has 2 images and when i replace the listview i reuse it. Here you have my code, first the declaration of the listview, and second, how i add during the program one element.
Thanks for to take a look into this.
Declaration:
'
'ListView2
'
Me.ListView2.AccessibleDescription = resources.GetString("ListView2.AccessibleDescription")
Me.ListView2.AccessibleName = resources.GetString("ListView2.AccessibleName")
Me.ListView2.Alignment = CType(resources.GetObject("ListView2.Alignment"), System.Windows.Forms.ListViewAlignment)
Me.ListView2.Anchor = CType(resources.GetObject("ListView2.Anchor"), System.Windows.Forms.AnchorStyles)
Me.ListView2.BackgroundImage = CType(resources.GetObject("ListView2.BackgroundImage"), System.Drawing.Image)
Me.ListView2.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.clh_1, Me.clh_2, Me.clh_3, Me.clh_4, Me.clh_5, Me.clh_6, Me.clh_7, Me.clh_8, Me.clh_9, Me.clh_10})
Me.ListView2.Dock = CType(resources.GetObject("ListView2.Dock"), System.Windows.Forms.DockStyle)
Me.ListView2.Enabled = CType(resources.GetObject("ListView2.Enabled"), Boolean)
Me.ListView2.Font = CType(resources.GetObject("ListView2.Font"), System.Drawing.Font)
Me.ListView2.FullRowSelect = True
Me.ListView2.GridLines = True
Me.ListView2.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable
Me.ListView2.ImeMode = CType(resources.GetObject("ListView2.ImeMode"), System.Windows.Forms.ImeMode)
Me.ListView2.LabelWrap = CType(resources.GetObject("ListView2.LabelWrap"), Boolean)
Me.ListView2.LargeImageList = Me.ImageList1
Me.ListView2.Location = CType(resources.GetObject("ListView2.Location"), System.Drawing.Point)
Me.ListView2.Name = "ListView2"
Me.ListView2.RightToLeft = CType(resources.GetObject("ListView2.RightToLeft"), System.Windows.Forms.RightToLeft)
Me.ListView2.Size = CType(resources.GetObject("ListView2.Size"), System.Drawing.Size)
Me.ListView2.SmallImageList = Me.ImageList1
Me.ListView2.TabIndex = CType(resources.GetObject("ListView2.TabIndex"), Integer)
Me.ListView2.Text = resources.GetString("ListView2.Text")
Me.ListView2.View = System.Windows.Forms.View.Details
Me.ListView2.Visible = CType(resources.GetObject("ListView2.Visible"), Boolean)
Add element with imageindex set on 0
Dim item As New ListViewItem("") ' 0
item.ImageIndex = 0
item.SubItems.Add("-") ' 1
item.SubItems.Add("-") ' 2
item.SubItems.Add("-") ' 3
item.SubItems.Add("-") ' 4
item.SubItems.Add("-") ' 5
item.SubItems.Add("0") ' 6
item.SubItems.Add("0") ' 7
item.SubItems.Add("0") ' 8
item.SubItems.Add("No") ' 9
Me.ListView2.Items.Add(item)
|
|
|
|
|
I don't immidiatly know why you're images disapear but I'd start by trying to figure out when exactly they disapear
(after a specific action or time)
also try triming you're code to the minimum (perhaps even rewrite some in a differant project and see if the same happens there)
since I'v never encountered this before (and I'v used listviews with images a few times before) I would think that somewhere in you're code there is a mistake that clears the images from the listview or the images from the imagelist
so I'm afraid this might be one of those trial and error debugging things
|
|
|
|
|
Do you think that all these lines are normal? For example: CType(resources.GetObject("ListView2.Dock"), System.Windows.Forms.DockStyle)
It is referring to the resources file, I am a C# programmer, but I have to make something in vb.net and in .NET 1.1, so I am using VS2003. I never saw this before.
Another, if I change the listview, i have images for a while and than it falls back to its old habit.
This sucks. I'll try to figure out what is causing this problem.
|
|
|
|
|
did you import you form or did you start from scratch, added the listview, set its properties,...?
it is possible that you get strange code like that from the designer when importing a form or when copying a control (I don't know why or how but it doesn't always work)
if you did copy it or import it I would suggest you make a new project and start from scratch there (not you whole prog just the bit with the lisview code) and see if you still have the behavior you described if so then something is probebly wrong with the code if you don't get that behavior and you copyed it or imported it then that is probably the reason
if you could providy more detail about all this I might be able to reproduce the behavior and help you further
|
|
|
|
|
Well what i do is i drag a listview from the toolbox on the form, set the options that i like one by one, and between I run my code in order to see where it goes wrong. And the conclusion is that i arrive to what I would like to have and the images are there.
In the meanwhile i am creating other classes, not really working on that form, and on a sudden debugging the images are disappearing. Pff, I don't know what is going on.
|
|
|
|
|
Then I'm afraid I'm at a lose aswel the code you pasted above shouldn't have been generated if you draged it from the toolbox (there should have been a very differant looking code)
all I can think of is recoding that part (delete the listview and put it back set its properys, name it the same as before so that you're code still works)
sorry I couldn't be more helpfull
|
|
|
|
|
Well, i am perplex myself also. I go to finish the application and recreate it from scratch, because i don't know what is going on. Damn, i wish i could program in VS2005
Thanks anyway for looking at my problem.
|
|
|
|
|
I want to pull data from two tables with a restriction on one field (only if a certain value). I want to then load into a dataset. Then be able to filter. Then offer user to change fields and write back to the database tables. What would be the best way to do this? I thought I could run a query to get the data in one table and then load into a dataset. But, it does not seem so easy to update the two tables. I am not familar with sql. Are there any articles you would suggest?
|
|
|
|
|
Cory Kimble wrote: But, it does not seem so easy to update the two tables. I am not familar with sql.
You're going to have to learn SQL in order to do this, or any other database related project. I highly suggest picking up a book on SQL Server 2005 and going through it. The book might come with SQL Server 2005 Express Edition (free), or you can download it from Microsoft.
If you write your query correctly, the DataAdapter object will fill a DataSet for you in as many DataTable and DataRelation objects as required.
|
|
|
|
|
I know how to use the hashtable. So far I have my program working by sending the forms to the hastable in code. Like so...
dim ptr as windows.forms.form
ptr = new frmOne
hashtable.add(ptr)
what I would like to do is replace the code above with code that will dynamically populate the hashtable, something to the effect of...
if projecttype\object\whatever is a system.windows.forms.form then
hashtable.add(projecttype\object\whatever)
I can't figure out how to do it
I tried using reflection.assembly.getexecutingassembly however a forms BaseType is not always stated as system.windows.forms.form it can also be the project namespace.formname, which completely negates the whole purpose of using it.
Ferron
|
|
|
|
|
I've got a bigger question. Why are you trying to do this at all?? What's the point of jumping through all these hoops?
|
|
|
|
|
I need to create a hashtable collection of all the forms in my project.
It needs to be done in code and it needs to be done without any user input.
It also needs to be able to be portable from one project to another without rewritting any code, so the list needs to be created dynamically.
Do u know how to achieve this, or can anyone point me in the correct direction?
Thanks
Ferron
|
|
|
|
|
ferronrsmith wrote: I need to create a hashtable collection of all the forms in my project.
It needs to be done in code and it needs to be done without any user input.
I'll ask again. Why??
|
|
|
|
|
Hello,
I have a VB.net Windows forms application that utilizes a rather large label control to display weights from a scale. My only problem is that I can't get the label.text alignment right. The text appears to go completely off the area that the label occupies. I've tried every setting for the "TextAlign" property. They all seem to go whack-o. Any ideas on what could be causing this bizarre behavior?
Thanks,
T-Tops
|
|
|
|
|
Is the label's AutoSize property set to False?
Other than that, there isn't sufficient information to tell you anything except how to label control works. How did you setup this label?? How long is the Text string?? Does it actually overflow the left, right side, or both sides, of the label? Are you looking for a single line of text to fit in the label as a single line?? Are you trying to break up the text so it occupies multiple lines in the label?
|
|
|
|