|
I used to do this before changing to RS.
Have a form with a viewer only
Create and test your report in CR and save it as a .RPT file. Report should be based on stored procedure or at least a paramaterised query (I always used procs).
In VB create a report (CR) using the .RPT file name (can't remember the details)
Pass in the parameters as CR parameter array
Connect the table objects in the report to the database
Pass the report object to the viewer
Show the MDI form.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi,
I want to include/create a chart in my program which displays titles of x and y axis and then saves the chart/graph as an image file. What would be the robust way to do that!!
Thanks,
Aman
|
|
|
|
|
hi,
may this Create Column Chart Help you.
for save chart use following statement
AxChartSpace1.ExportPicture("C:\abc.jpg", "Jpg", 640, 400)
hope this helps
|
|
|
|
|
You would either have to create a new user control or you would have to use a third-party control.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my Blog
|
|
|
|
|
Google for "ZedGraph". It's a free graphing library that will probably have the type of chart you're looking for.
|
|
|
|
|
Thanks Dave for the tip. It worked for my application; however, do you know the statement for saving a ZedGraph chart/graph as an image (jpg, bmp etc.)!
Aman
|
|
|
|
|
Nope. I've never used the library. That's a question for the people who made it.
|
|
|
|
|
Trying to get the title and artist data from the id3v1 in a .mp3 file
id3v1 info = http://www.id3.org/ID3v1
Heres more code:
Private Sub bAddFolder_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bAddFolder.Click
For Each filePath As String In IO.Directory.GetFiles(DirListBox1.Path, "*.mp3", IO.SearchOption.AllDirectories)
Dim Title(30) As Byte
Dim Artist(30) As Byte
Dim mp As FileStream = New FileStream(filePath, FileMode.Open)
mp.Seek(-125, SeekOrigin.End)
mp.Read(Title, 0, 30)
mp.Seek(-95, SeekOrigin.End)
mp.Read(Artist, 0, 30)
mp.Close()
Dim TxtTitle As String = System.Text.Encoding.Default.GetString(Title)
Dim TxtArtist As String = System.Text.Encoding.Default.GetString(Artist)
fMain.ListView1.Items.Add(TxtArtist + " - " + TxtTitle).SubItems.Add(filePath)
Next
End Sub
Whats happening is it doesn't seem to be reading the data correctly....I get blanks in my listview or weird characters or just the artist and no title....all the mp3's i am testing have both the artist and title data in them (i checked through winamp)
|
|
|
|
|
|
kjdion wrote: mp.Read(Title, 0, 30)
You have ignored the return value from the method call. The method returns the number of bytes that was actually read, and that can be less than the requested number of bytes. If the number of bytes read is less than the request number of bytes, you have to repeat the call to get the rest of the data until you have got all the data.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
hi! i'm new to vb .net..i want to calculate a power, i want to do it in a function..i'm having a hard time with arguments and parameters as well as with the return value.
please help! i have 2 text boxes for accepting inputs for base and exponent.
Public Class Power
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim base, exp As Integer
base = Val(text1.Text)
exp = Val(text2.Text)
MessageBox.Show("Power: " & Power(base, exp)) //how about this??
End Sub
Function Power(ByVal x As Integer, ByVal y As Integer)
Dim pow, i As Integer
Select Case y
Case 1
MessageBox.Show(x & " raised to " & y & " is 1")
Case 0
MessageBox.Show(x & " raised to " & y & " is 0")
End Select
For i = 2 To y
Return pow = pow * x //is this correct??
i += 1
Next
Return ??what/how??
End Function
End Class
|
|
|
|
|
Have you tryed:
dim Number as integer = 2
dim Power as integer = 5
dim x as integer = Number ^ Power
Alexei Rodriguez
|
|
|
|
|
trying to do the calculation inside a loop, not using nay math method or ^..
thank you!
|
|
|
|
|
ay3ssah wrote: Function Power(ByVal x As Integer, ByVal y As Integer)
You should specify the return type of the method, otherwise the return type will be Object .
Function Power(ByVal x As Integer, ByVal y As Integer) As Integer
ay3ssah wrote: Case 1
MessageBox.Show(x & " raised to " & y & " is 1")
That is not correct. x raised to 1 is x, not 1.
ay3ssah wrote: Case 0
MessageBox.Show(x & " raised to " & y & " is 0")
That is not correct. x raised to 0 is 1, not 0.
ay3ssah wrote: Return pow = pow * x //is this correct??
No, that is not correct. As you don't initialise the pow variable, it will be zero from start. Anything times zero is still zero, so the final result will always be zero.
ay3ssah wrote: i += 1
If you increment the loop variable in the loop, that will have the same effect as having a loop with step 2 . The For...Next statement increments the loop variable automatically.
ay3ssah wrote: Return ??what/how??
Return pow
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
whoaa!!! i did all of that but i erased it..hehe
did i mention that the calculation should be done in a loop? not with Math.pow or ^ sign..
is it ok to return one argument even if there are two parameters?
thank you so much! il try all of that later..
|
|
|
|
|
You can only return one value from a function, unless you use byref parameters or you create your own class or structure, or you return an array
Alexei Rodriguez
|
|
|
|
|
Hi
im using vs2005, try this
************************************
dim Out as double
out = Math.Pow(Number,Power to raise by)
ie. out = math.Pow(5,2)
out = 25
**************************
Anoop
|
|
|
|
|
i want to use looping instead of ^ and math.pow..thanks!
|
|
|
|
|
How do I write code for?
Catch Format Exception (invalid input)
This is for a program that only has you selecting from 0-3 and anything else is an invalid input.
|
|
|
|
|
You only want the user to be able to enter 0, 1, 2, or 3 in a text box?
|
|
|
|
|
That is correct or they get a format exception error.
|
|
|
|
|
In the textbox's KeyPress event, check to make sure that the character entered is either a 0, 1, 2, or a 3. If it is, then set e.Handled = True . If not, then you can raise the error that you want to raise and set e.Handled = False .
|
|
|
|
|
Thanks, but I have to use a try catch statement for this one.
|
|
|
|
|
Hello everybody,
having to work with an uncommon image format (dpx, a bitmap which is not supported by GDI+) I tried a few libraries which support the format as well as Visual basic. My knowledge of VB is still too little to implement the new image object successfully and show a dpx-picture in a picture box.
Maybe somebody can help me with the basics a bit? In the particular case, I'm using a free graphics Library used by the famous XnView. My following code throws an error saying that the COM-Object couldn't be converted:
Imports GflAx
Private MyImage As GflAx.GflAx
Public Class clsXn
Public Sub ShowMyImage(ByVal fileToDisplay As String, ByVal xSize As Integer, _
ByVal ySize As Integer)
' Sets up an image object to be displayed.
If (MyImage IsNot Nothing) Then
MyImage.Dispose()
End If
' Stretches the image to fit the pictureBox.
frmHead.pbox.SizeMode = PictureBoxSizeMode.StretchImage
MyImage = New GflAx.GflAx
MyImage.LoadBitmap(fileToDisplay)
frmHead.pbox.ClientSize = New Size(xSize, ySize)
frmHead.pbox.Image = MyImage '<------- ERROR THROWN
End Sub
end class
The function is called from the form with
Private Sub btnTestXn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTestXn.Click
Dim Xn As New clsXn()
Xn.ShowMyImage("D:\Test\pic1041.dpx", 192, 108)
End Sub
What did I forget or how can I solve the issue?
I'm a bit afraid that I ran into a GDI+ issue that only accepts certain formats, but I thought using the third party object this would have been solved.
Thanks for any advice,
Michael
|
|
|
|
|
Your code is trying to convert an object of type GflAx to a .NET Image object. That's not going to work. The GflAx object has to expose some method to return an Image object. You're best source of information on this would be the people or forums that created/deal with this image library.
|
|
|
|