|
well , i think i have to be stupide to get the correct answear of ma question
i'm a beginner & i thaught i know what is dataadapter but today morning i know that i no nothing may be
i wanna make sure please if you can help
well i won't right a story this is the code :
private sub AddTable (Str as String,TbName as String)
Cmd.commandtext = Str
Adapter = new sqldataadapter(Cmd)
Adapter.Fill(DtSet,"Room")
End Sub
with this methode i create a datatable
UpdtData(Adp as sqldataadapter,tbN as string)
CmdBuilder = new SqlCommandBuilder(Adp)
Adp.Update(DtSet,"Room")
Dtset.clear
Adp.Fill(DtSet,"Room")
End sub
with this methode i update the DB
i just create all the datatables with the same methode that mean i use the same command & the same adapter to fill the data set is that wrong ??
what i know is that the data adapter is just a bridge or not a bridge it uses the command to access DB extract rows & fill the dataset that mean he don't have tables in on something
then why it don't want to update in the DB ??
i built two data tables with the same methode AddTable()
but when i wanted just to update one table "Room"
UpdtData(Adapter,"Room")
it threw an exception
i hope you understood me
may you help ??
try to be good if you can't be the best
|
|
|
|
|
what the exception message says ?
is the connection open?
-- modified at 20:24 Monday 8th May, 2006
|
|
|
|
|
thanks man for the help ,
No it didn't say in the connection
it just colored the line :
Adapter.Update(DtSet,"Room")
in green & it threw "Erreur Systeme" i use the french edition
try to be good if you can't be the best
|
|
|
|
|
Being new to VB.NET, I'm using the form wizard to get me started on a small app.
I've used the form wizard to create my form, and I've put the fields into a tab control on tab 1.
There is probably a better way of doing the next bit, but on tab 2, I want a subform so that I can cheat, and use the form wizard to create my second form, and have tab 2 'look' at my other wizard generated sub form.
Is this possible?
|
|
|
|
|
be more speciefic,
you mean u used the form wizard to create a data form? and then created a tabcontrol and cuted - paste all the labels, textboxes, buttons etc... inside the tabcontrol ???
and now you want to make a clone of the tabpage1?
what do you mean subform ?
|
|
|
|
|
I did the cut and paste as you describe into tab 1.
I then created tab 2, and now I want my subform in tab 2.
By subform, I mean something along the lines of MS Access' subform - a form within a form.
To be honest ... I figured out how to do what I needed to do without the subform and wizard on this occasion, but I'd still like to know how to create subforms for future reference.
|
|
|
|
|
I don't know your code but you don't need tabcontrol at all. Try making a button in your first form and place the followincode
Dim SubForm2 As New yourcurruntformname
'Display the new form.
SubForm2.Show()
|
|
|
|
|
I am trying to use the ReportViewer control in VS2005 (VB). I have set up a report, and it works great to use a set query to fill the reports. I would like to allow the user to enter data at run time, and then generate a query to create a new dataset. I would then like the report to use this new dataset as its datasource.
There seems to be a lot out there on Crystal, but not much for the ReportViewer that comes with VS2005. Can anyone help me with changing the data source of the report at runtime?
Any help would be greatly appreciated. Thanks in Advance!
Mark G.
|
|
|
|
|
Hi there,
I just upgraded an interactive app for traffic & transportation modeling to vb.net, it works excellent and its fast contrary to expectations. however i got a huge problem. everytime any control gets repainted, the graphics or the simulation running disappears. so i browsed through the internet and learned that i have to override the Paint function and make everything to be drawn to go out from teh picture or panel paint function. this works excellent in small cases and apps, but i got about 25 classes and 20 forms ? each of these classes generates a part of the simulation. does anyone know how i can keep my GDI+ graphics from disappearing, with an actual code.
for example
public sub CodeDisappear()
fix my stinking problem bill gates
end sub
Thanks,
Dassouki
|
|
|
|
|
Hi I create a contextmenu from data. my code is this
Private Sub devsubmenu()
Dim cmddev As New OleDbCommand("Select modelname from devicetbl", OleDbConnection1)
OleDbConnection1.Open()
Dim dtread As OleDbDataReader = cmddev.ExecuteReader()
devmnu.MenuItems.Clear()
Do While dtread.Read
devmnu.MenuItems.Add(dtread.Item("modelname").ToString())
Loop
OleDBConnection.Close()
End Sub
The menu created is fine.
Now when i click one of the menu items created with the code above i want to take the "text" of the menu item and store it to a variable.
Here is my problem, how can i handle a click event from these items?
Any Ideas???
|
|
|
|
|
Instead of adding like this
devmnu.MenuItems.Add(dtread.Item("modelname").ToString())
do this
Do While dtread.Read
Dim ChildMenu As New MenuItem
ChildMenu.Text = ""
AddHandler ChildMenu.Click, Procedure name to use
devmnu.MenuItems.Add(ChildMenu)
Loop
Rizwan Bashir
|
|
|
|
|
ok i changed my code to :
Do While dtread.Read
Dim ChildMenu As New MenuItem
ChildMenu.Text = dtread.Item("modelname").ToString()
AddHandler ChildMenu.Click, model_click
devmnu.MenuItems.Add(ChildMenu)
Loop
i inserted a breakpoint in procedure model_click and when i click my menuitem the program isn't calling my procedure
Private Sub model_click(ByVal sender As System.Object, ByVal e As System.EventArgs)
do domething ...
end sub
Thanx
|
|
|
|
|
use this line to add the handler
AddHandler ChildMenu.Click, addressof model_click
Regards
Rizwan Bashir
|
|
|
|
|
sorry you are right.
i noticed that after i posted the message
you where very helpful but now do i get the text of the menuitem which is declaerd within the do while statement in the handle procedure model_click?
this is my code
Private Sub devsubmenu()
Dim cmddev As New OleDbCommand("Select modelname from devicetbl", OleDbConnection1)
OleDbConnection1.Open()
Dim dtread As OleDbDataReader = cmddev.ExecuteReader()
devmnu.MenuItems.Clear()
Do While dtread.Read
Dim ChildMenu As New MenuItem
ChildMenu.Text = dtread.Item("modelname").ToString()
AddHandler ChildMenu.Click, AddressOf model_click
devmnu.MenuItems.Add(ChildMenu)
Loop
OleDbConnection1.Close()
End Sub
End Sub
Private Sub model_click(ByVal sender As System.Object, ByVal e As System.EventArgs)
' Get childmenu.text here
End Sub
|
|
|
|
|
sender is the menu. so
sender.text is the text and so on. you can play with the properties using
sender. Name of property
Rizwan Bashir
|
|
|
|
|
Thank you !!!
|
|
|
|
|
I have a program that can scan an image. I have a msgbox come up after each scan asking if the user wants to add a page to the original scan. Can anyone help me with this problem. Below is the code:
NextPage:
On Error GoTo ScanErr
'Scan an Image
If ImgScan1.ScannerAvailable = True Then
With ImgScan1
.OpenScanner
.StartScan
End With
ImgEdit1.Image = ImgScan1.Image 'sets imgedit1 to show scanned image
ImgScan1.CloseScanner 'close scanner
Else
MsgBox "Scanner Not available!", vbExclamation, "Error!"
End If
ScanErr:
If Err.Number = 1002 Then 'Exited without scanning
Exit Sub
Else
Exit Sub
End If
-- modified at 14:58 Monday 8th May, 2006
|
|
|
|
|
use this
With ImgScan1
.MultiPage=true
.OpenScanner
.StartScan
End With
' adding multi page will not stop the scanner. Like if you have ADF Scanner then it will stop when all the papers are scanned in feeder.
Regards
Rizwan Bashir
|
|
|
|
|
I have a project that I have successfully completed using VISUAL BASIC 6 PROFESSIONAL and ACCESS as back end. Now I want to convert this codes to VB.NET how do I acheive this or how do I go about it.Thanks
Ademola
|
|
|
|
|
After ensuring that your VB6 prog works without errors do...
Run VB.Net open the vb6 project using file/open project this will lauch the upgrade wizard. A few seconds/minutes later there will be a _UpgradeReport.html file in solution explorer.
Study that document it should tell you what it was able to upgrade and that which it could not, and prepare for some disappointments. The upgrade wizard tries its best but is not perfect.
In any case, fire-up the help file that comes with vb.net and search the index for "Upgrading a project with the upgrade wizard" and it walks you through what happens.
modified 1-Aug-19 21:02pm.
|
|
|
|
|
Thanks for your respond. but i want to know may be this is applicable as to convert VISUAL BASIC 6 TO VISUAL STUDIO 2003 AND 2005 as the way I will convert it to VISUAL STUDIO .NET
Ademola
|
|
|
|
|
Yes, I understand they are similar.
BUT
As in my original reply, the MSDN help file will guide you.
modified 1-Aug-19 21:02pm.
|
|
|
|
|
how to add a windows control(e.g. Button Control) to a collection
Suman
|
|
|
|
|
What kind of collection do you mean?
ArrayList list = new ArrayList();
list.Add(button);
|
|
|
|
|
'Declaring Collection
Dim mycol as collection
'If I have two button control button1 & button2, Then I want to add this two button to the collection so that I can control them using
"For each button in mycol " command
Thank you
Suman
|
|
|
|