|
I found out how to automatically get primary keys
Anyways, i just wanted to post it here, just in case someone else needs it.
On the dataadapter, just set the da.MissingSchemaAction = MissingSchemaAction.AddWithKey
Example:
==================
Dim ds1, ds2 As New DataSet
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ds1.Tables.Add(OpenTbl("SELECT * FROM Adscripciones", "Adscripciones"))
ds2.Tables.Add(OpenTbl("SELECT * FROM Adscripciones", "Adscripciones"))
ds1.Merge(ds2)
Me.DataGridView1.DataSource = ds1.Tables("Adscripciones")
End Sub
Public Function OpenTbl(ByVal SQL As String, ByVal NombreDeTabla As String) As DataTable
Dim da As New SqlDataAdapter(SQL, conn)
Dim T As New DataTable
Try
'I was missing this line at the beggining
da.MissingSchemaAction = MissingSchemaAction.AddWithKey
da.Fill(T)
T.TableName = NombreDeTabla
Catch ex As Exception
Return Nothing
End Try
Return T
End Function
===========================
Thank anyways
Alexei
Its good to know that theres always someone willing to help others
|
|
|
|
|
Currently, I'm doing a project using VB6. Now, I've create 2 forms, let's say Form1 and Form2. Now, I have done the link between these form. User can click on a button in Form1, then a "pop up" of Form2 is appears. So the user can key in their value here in textbox (in Form2) for example (for other mathematics calculation stuff). The problem here is...HOW I can display what the user "key-in" in the Form2 will be display too in Form1 . Please give the code.
Hopefully to hear from you A.S.A.P, Thank You
Than You
-- modified at 10:21 Wednesday 1st February, 2006
|
|
|
|
|
if I understand what you mean, here's the solution:
make a global variables, 4Ex:
module main
dim objFrm1 as new Frm1
dim objFrm2 as new Frm2
Dim GV_key as string
sub main()
GV_key = objfrm1.key
objfrm2.key= GV_Key
end sub
end Module
Militiaware
Faris Madi
|
|
|
|
|
militiaware wrote: make a global variables
Global variables!!! NO! NO! NO! NO! NOOOO!!!
Jeez, don't they teach that this is bad practice in CS classes any more?
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
militiaware wrote: make a global variables
:SMACK: That's REALLY bad practice!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Sorry Faris Madi!
I disagree with you strongly! It is a very bad programing practice to use global variables to pass data between classes (forms). Use events instead!
Supose you have a TextBox on one form and you want to inform the other form whenever it's contents was changed - raise an event with the changed contents as an argumet.
You need to declare the event on the form where the TextBox resides. Then, you need to have a "withevents" variable referencing that form within the second form. Then, attach an event handling procedure on the second form to handle what's need to be done whenever the TextBox's contents changes and the event is raised.
Hope I've helped here.
Walk the way. Top down.
|
|
|
|
|
ohh i forgot this solution completely.....
thanx for the TIP nata.
Militiaware
Faris Madi
|
|
|
|
|
Hi All,
I am new to TAPI and MSComm.I will be greatful if you could
spare some time for me to help me in this regard.
Problem:
I need my phone to go OffHook and OnHook using Visual Basic.
I am able to collect the Device Info(D-Link DFM562E++ Modem)
using my code.
I have read somewhere that,
'You could try doing a lineMakeCall() with a ";" dial string. I
believe this should take the phone off hook and create a new dialtone
call. It may timeout after some time and transition to IDLE or you
may be able to drop it with lineDrop'
I tried this but it didnt work.
I placed one MSComm control and :
MSComm1.Settings = "56000,N,8,1"
MSComm1.CommPort = 2
MSComm1.InputLen = 0 'Default anyway
MSComm1.RThreshold = 1
MSComm1.PortOpen = False
MSComm1.Output = "ATE0" & vbCr
But there was no Offhook Signalling sound generated.
Can anybody please suggest me a solution for this
Thanks
Nishanth
|
|
|
|
|
Hello! I have a picturebox1 and its sizemode is set to strechimage. So the actual image size is bigger than the picturebox1 size. My aim is to draw the image as big as picturebox1 size as streched to see all image not a part of the image. Somethig is wrong in the code below because it only draws the area (Picturebox1 size) of the image. I am not able to scale the image.
Any help!
Thanks!
BJ
Private Function DrawImageCallback(ByVal callBackData As IntPtr) As Boolean
'Test for call that passes callBackData parameter.
If callBackData.Equals(IntPtr.Zero) Then
' If no callBackData passed, abort DrawImage method.
Return True
Else
' If callBackData passed, continue DrawImage method.
Return False
End If
End Function
' Copy the watermark image over the result image.
Private Sub DrawWatermark(ByVal watermark_bm As Bitmap, _
ByVal result_bm As Bitmap, ByVal x As Integer, ByVal y As Integer)
Dim imageCallback As New Graphics.DrawImageAbort(AddressOf DrawImageCallback)
Dim imageCallbackData As New IntPtr(1)
' Create rectangle for adjusted image.
Dim destRect2 As New Rectangle(PictureBox1.Location.X, PictureBox1.Location.Y, PictureBox1.Width, PictureBox1.Height)
Dim es As Graphics = Graphics.FromImage(result_bm)
' Create image attributes and set large gamma.
Dim imageAttr As New ImageAttributes()
'imageAttr.SetGamma(4.0F)
' Draw adjusted image to screen.
' Draw adjusted image to screen.
es.DrawImage(watermark_bm, destRect2, PictureBox1.Location.X, PictureBox1.Location.Y, PictureBox1.Width, PictureBox1.Height, GraphicsUnit.Pixel, imageAttr, imageCallback, imageCallbackData)
imagination is the seed value of creation!
|
|
|
|
|
Private Function DrawImageCallback(ByVal callBackData As IntPtr) As Boolean
'Test for call that passes callBackData parameter.
If callBackData.Equals(IntPtr.Zero) Then
' If no callBackData passed, abort DrawImage method.
Return True
Else
' If callBackData passed, continue DrawImage method.
Return False
End If
End Function
' Copy the watermark image over the result image.
Private Sub DrawWatermark(ByVal watermark_bm As Bitmap, _
ByVal result_bm As Bitmap, ByVal x As Integer, ByVal y As Integer)
Dim imageCallback As New Graphics.DrawImageAbort(AddressOf DrawImageCallback)
Dim imageCallbackData As New IntPtr(1)
' Create rectangle for adjusted image.
Dim destRect2 As New Rectangle(PictureBox1.Location.X, PictureBox1.Location.Y, PictureBox1.Width, PictureBox1.Height)
Dim es As Graphics = Graphics.FromImage(result_bm)
' Create image attributes and set large gamma.
Dim imageAttr As New ImageAttributes()
'imageAttr.SetGamma(4.0F)
' Draw adjusted image to screen.
' Draw adjusted image to screen.
es.DrawImage(watermark_bm, destRect2, PictureBox1.Location.X, PictureBox1.Location.Y, PictureBox1.Width, PictureBox1.Height, GraphicsUnit.Pixel, imageAttr, imageCallback, imageCallbackData)
|
|
|
|
|
hi. i'm a new bie in vb.net. I'm currently developing a multilingual project. I'm unable to change the regional language settings when the current thread changes from one language to the other. If anybody could help me, please find a solution for this.
-Ganesh Pradeep.R
|
|
|
|
|
hi dear friends programmers
i need a program or some code such as an email in windows form vb.net that i want the clients can send and receive file from eachother in the lan in one department.
i am not master in vb.net and i have to solve this problem immediately.
please help me . untile now i cant find functional and good code for it to use.
thanks alot for your care and help.
(i use visual studio 2003)
i am await for your helps....
pantea
|
|
|
|
|
Look up System.Web.Mail.SmtpMail/MailMessage classes. They have methods and properties that allow you to specify attachments/relay server etc.
- Malhar
|
|
|
|
|
Hi And Thanks for your care
but iam new in programming vb.net and really i dont know how to use or make it.
please describe more ,if you can
thanks alot
|
|
|
|
|
The following code in VB shows the error : "Undefined function 'round' in expression".
[CODE]
DataEnvironment1.Commands(1).CommandText="Select Round(Altitude,2) from Alt"
[\CODE]
Here, Altitude is a variable of type 'Number-Double'
Alt is a table in MS-Access Database.
Help me regarding this.
Thanks in advance.
-- modified at 2:18 Wednesday 1st February, 2006
|
|
|
|
|
Try:
DataEnvironment1.Commands(1).CommandText="Select Round(" & Altitude & ", 2) from Alt"
|
|
|
|
|
Altitude is not a variable used in VB. Altitude is a Field in table Alt.
|
|
|
|
|
I tried using Round in a query in Access, and that works fine, just as expected.
Are you sure that it is an Access database that the connection is connecting to?
Are you sure that the query that you have shown is causing the error? The code you show can never cause that error by itself, there has to be som code that runs the query also.
---
b { font-weight: normal; }
|
|
|
|
|
It is in access database only.
I am getting the values if i use the query without using round function.
It is showing error when i use the round function
|
|
|
|
|
What is the complete error message?
What databasedriver are you using, e.g. what does your connectionstring look like?
---
b { font-weight: normal; }
|
|
|
|
|
Error Message : "Undefined function 'round' in expression".
Connection String : Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Premalatha\30_01_06-VrefAnalysis\VrefAnalysis.mdb; Persist Security Info=False
Database Driver : Microsofy.Jet.OLEDB.4.0
-- modified at 7:07 Wednesday 1st February, 2006
|
|
|
|
|
PremalathaP wrote: Select Round(Altitude,2) from Alt
Try:
SELECT ROUND(Alt.[Altitute], 2) FROM Alt
|
|
|
|
|
Does anyone know how to capture webcam images using avicap32.dll and not save the images to the clipboard. I would like to be able to actually stream the images 'into' the a picture box or any other control capable of holding an image, and then retrieve an image at any given time by way of the Image property. I do not want to use the clipboard because in my app a user may be using it for other things such as text editing, etc.. I have used DirectShow but avicap32.dll in my case would be better suited.
Any help at all would be appreciated.
-Jason
|
|
|
|
|
|
My whole post was about avoiding the clipboard, when reading the documentation, it says there are alternatives to the clipboard, but i have yet to make any of them work.
Since my app should allow for text editing in other areas of the app, I do not want to use the clipboard, for this reason...
I was using the clipboard to start, but then when testing, i realized that I was losing some stuff that I had copied and had been replaced with an image.
So then I decided as a workaround to right before I save the image to clipboard, I would copy the contents in the clipboard to memory, then send the image to it, retrieve the image back, then reset the contents of the clipboard back to its original contents. Most of the testing I did like this worked ok, but every now and then, the contents would get mixed up and where it should be saving an image it was saving text that was copied into the clipboard and vice versa.
The documentation states that you can save it to some sort of an independant bitmap, but I do know how to go about doing that.
Any suggestions?
-Jason
|
|
|
|