|
Creating Connection Using DSN is very easy.
Go to Control Panel > Administrator Tool > ODBC Data Source then use select System DSN or USER DSN.
then click on add button then a dialog will be open and select Microsoft Access Driver(*.mdb) and finish.
then a window will be open then following information must be enter.
Data source name : Name of DSN
Database Path : path of data base
Login : name of admin
Password : password of access database if required
then Select Crystal report and Create connection via DSN.
If you can think then I Can.
|
|
|
|
|
thanks a lot anu...
I will surely try this and come to you back....right now suddenly I have to be busy with job hunting...
so May be i will get back to u by next week....Hope thats ok....
Thanks a lot anyway
-----------------------------
I am a beginner
|
|
|
|
|
Hello
Can any one tell me why?
Warning 1 Function 'ReturnMultipleValue' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used.
Public Function ReturnMultipleValue(ByVal MyQuery As String) As DataSet
Try
Dim ds As DataSet
con = New OleDbConnection(ConnString)
da = New OleDbDataAdapter(MyQuery, con)
ds = New DataSet
con.Open()
da.Fill(ds)
con.Close()
Return ds
Catch ex As Exception
mdChecking.Prompt(ex.Message.ToString)
If con.State = ConnectionState.Open Then
con.Close()
End If
End Try
End Function
|
|
|
|
|
Because if your code breaks and enters the Exception handler, there is nothing in there returning a DataSet value, nor is there anything after the End Try statement that returns a value.
A better practice would be to declare your return variable before the Try statement, set it's default return value, then go through the code in your Try block WITHOUT returning a value, then after the End Try statement, put your Return statement.
You should really be using a Try/Catch/Finally setup here. Something more like (this is NOT entirely best practice!):
Public Function ReturnMultipleValue(ByVal MyQuery As String) As DataSet
' Default return value.
Dim ds As DataSet = Nothing
Try
' Setup and retrieve your data...
con = New OleDbConnection(ConnString)
da = New OleDbDataAdapter(MyQuery, con)
ds = New DataSet
con.Open()
da.Fill(ds)
Catch ex As Exception
' This will only execute when something goes wrong in the above Try block...
mdChecking.Prompt(ex.Message.ToString)
Finally
' This block will execute no matter what happens in the Try and/or Catch blocks...
If con.State <> ConnectionState.Closed Then
con.Close()
End If
End Try
' Returns either your default value (if something went wrong), or the new value from
' the Try block.
Return ds
End Function
|
|
|
|
|
Thank You
That removed the Warning
|
|
|
|
|
hi there,
I am in a little trouble here. I have a database with employee names details etc.. and I also have a child sub table for their absence. what I want my program to do:
I have a list box that loads full employee names and selects the record
once I click on it I want it to display the info from a child sub table according to the name selected.
I already know how to write to the child sub table but do not know how to display it.
any help would be appreciated.
the code I have written so far fills up the list box with all absence disregarding individual record.
thanks
|
|
|
|
|
What you are trying to do goes under the name of Master-Detail. Describing how to do it would take too much space, so it is best if you Google for master detail vb.net or master-detail vb.net you will find lots of examples/tutorials. Choose one that seems to fit your situation most, and have a play.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Thanks alot I will have a research on it.
|
|
|
|
|
I made working dragdrop code, but everytime , when i end the drop (correctly/incorrectly), i end up with a ping sound, under vista.
Anybody else also has this problem ?
It's rather anoying..
Jarno Burger
Video Jockey
|
|
|
|
|
Does anyone have a code snippet that shows how to get a clicked point on a zoomed graphic that corresponds to the same point on the unzoomed graphic?
|
|
|
|
|
Hint , start out by making a function like this :
Function ScalePointAToPointOnLineB(PointOnLineA , LengthLineA , LengthLineB)
And use this trick wisely..
Jarno Burger
Video Jockey
|
|
|
|
|
Thanks for your reply. I have a 42MB image in a user control that is scrollable, and capable of being zoomed out and in. If I click on the image when it is not zoomed I can get the coordinates of the clicked point. The problem is when I zoom in the device coordinates of course change when I click on the exact same spot on the graphic. I know I need to transform a matrix but I don't have much experience with this particular transformation. I would lke to be able to get the same coordinates of the image no matter if it is zoomed in or not, or scrolled. Any ideas regarding matrix transformation using the points.
|
|
|
|
|
Maybe your zoom could be more like a growing/shrinking rectangle instead of a double var ?
Then you could easily find mouse-position relative to your zoom-rectangle.
Then find your zoom-rectangle back in your pic in memory , and you'll have the pixel position.
But you could do this in 10 / 15 ways , all depends what you like yourself most.
But stick to the rectangles in rectangles concept, and only your mouse position as a position (relative to a rectangle to a reactangle to a rectangle to a rectangle etc...).
You'll need that later on , for other drawing stuff too..
Also , using default scrollbar behaviour to scroll a picture to left / right / up / down , first looks like a nice and easy idea.
But you'll end up writing patched stuff to let those scrollbars do what you want , when zoomed or something like that.
First dump the scrollbars. Try to build a drag (with middle mousebutton) first , or use arrow/+/- keys or something. Just for the learning experience.
Jarno Burger
Video Jockey
|
|
|
|
|
Well I dumped the scroll bars and have a panning aspect to scroll - I can pan the graphic and get the proper image coordinates. I have the scale of the horizontal and vertical. I can zoom in and out in many levels at increments of about 10%. As soon as I zoom in the coordinates of course change as they should. But I need the to be able to click the graphic at the exact same spot when zoomed in and receive the same coordinate of the exact same spot when not zoomed in. Here's what I have:
scaleX = CSng(Me.GetScreenRect.Width()) / Me.Width()
scaleY = CSng(Me.GetScreenRect.Height()) / Me.Height()
x = CInt(Math.Round(mouseXY.X * scaleX))
y = CInt(Math.Round(mouseXY.Y * scaleY))
Works fine when not zoomed in. I need the math that would allow for obtaining the same clicked spot while zoomed.
|
|
|
|
|
do you have any control, that you set your zoom level with? You need to get the value of it and use it to compute back your coorinates.
Regards: Didi
|
|
|
|
|
Yes. The mousewheel zooms the image in and out. So if i'm in 10% just reverse the the scale value from 1.1 to .9?
|
|
|
|
|
why not? Just try it out, if it's accurate, I think it should.
Regards: Didi
|
|
|
|
|
I'm making a solitaire game and figured out that the shuffle code doesn't show the Image1(0) card when the cards are shuffled in the design view. So that is one problem. I also am trying to drag and drop images from image1(0) to 12 from the left hand side of the design view to the right hand side where hearts(0) cards are. One thing, the hearts cards already have other bitmaps on them; they are blank boxes to show up for the person playing to automatically drop the image1 card in that slot. Here's what my newbie experience is so far...Oh, I also made tags in the design view to think they might help out.
Public Sub Main()
Start_Game.Show
End Sub
Private Sub Exit_Click()
MsgBox ("Thank you for playing. Good Bye.")
End
End Sub
Private Sub Start_Click()
Dim arrDeck(52)
Randomize
Dim Cardcount As Integer
Dim Counter As Integer
Dim Card1 As Integer
Dim Card2 As Integer
' Fill deck with cards in order 1 to 52
Do While Cardcount <= 52
arrDeck(Cardcount) = Cardcount
Cardcount = Cardcount + 1
Loop
' Shuffle the deck - end value (100)
Dim Temp As Image
Dim Index As Integer
For Index = 0 To 51
For Counter = 0 To 100
Card1 = Int(51 * Rnd)
Card2 = Int(51 * Rnd)
If (Card1 <> Card2) Then
Temp(Index).Picture = Image1(Card1).Picture
Image1(Card1).Picture = Image1(Card2).Picture
Image1(Card2).Picture = Temp(Index).Picture
End If
Next Index
Next Counter
' Now output images in order
For Counter = 0 To 51
Image1(Counter).Visible = True
Next Counter
End Sub
Private Sub Hearts_DragDrop(Index As Integer, Source As Control, X As Single, Y As Single)
Private Sub Image1_Click(Index As Integer)
If Image1(Index).Tag = Hearts(Index).Tag Then
Image1(Index).Picture = Hearts(Index).Picture
Hearts(Index).Picture = Source.Picture
Image1(Index).Visible = False
End If
Next
End Sub
End Sub
|
|
|
|
|
|
Here is one problem:
Card1 = Int(51 * Rnd)
This will give you a random number with 51 possible values, i.e. from 0 to 50. That means that you are never touching the last card in the deck.
You are doing 100 times as much work as you need to in order to shuffle the deck. You don't have to make more than 51 swaps to completely shuffle the deck, you just have to make sure that each card has an equal chance to be swapped into each position in the deck:
For card1 = 0 To 50
card2 = card1 + Int((52 - card1) * Rnd)
If card1 <> card2 Then
Temp = Image1(card1).Picture
Image1(card1).Picture = Image1(card2).Picture
Image1(card2).Picture = Temp
End If
Next Index
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Thank you for your comment, however, I did try 0 to 50 and 52 *RND first; It still has the same effect. I lose the Image1(0) card; the King of Hearts. If I use Temp as an Image for tghe shuffle it does not work. Says it is not a proper variable or is not set as one ; I try set command and that doesn't work. I try Image1(0).Picture in place of temp and I lose the King of Hearts card too of course; hence Image1(0). How do I shuffle the images with using a third variable for the shuffle correctly and not lose any cards at run time at display of images? Much appreciation in advance.
|
|
|
|
|
maybe you'll have to use a clone ?
Jarno Burger
Video Jockey
|
|
|
|
|
You know, maybe that's the key; I'll try that and let y'all know. Thanks.
|
|
|
|
|
Well, that was it! Thank you for the suggestion. I made a clone, made it invisible and used it in the swap, like this:
f (posn1 z<> posn2) Then
KingH(0).Picture = Image1
posn1).Picture
Image1(posn1).Picture = Image1(posn2).Picture
Image1(posn2).Picture = KingH(0).Picture
|
|
|
|
|
yeah ! cool !
whahoo ! we solved it !
Jarno Burger
Video Jockey
|
|
|
|