|
System.Net.Mail does not work either.
jmflanders
|
|
|
|
|
Ok, try these steps:
1. Import both System.Net and System.Net.Mail .
2. Go to your project's properties and click the "References" tab. Then make sure that the System.Net and System.Net.Mail name spaces are checked.
If you are using .Net 1.1, this might not work.
Trinity: Neo... nobody has ever done this before.
Neo: That's why it's going to work.
|
|
|
|
|
The code below is I copy from a book , and try to change using the memorystream. However, it didn't work.
What thing I lost?
Can someone help me? Thanks very much.
Dim stream As New MemoryStream
Dim m As Metafile
Dim g As Graphics = Me.CreateGraphics
Dim _hdc As IntPtr
_hdc = g.GetHdc
m = New Metafile(stream, _hdc)
g.ReleaseHdc()
Dim gr As Graphics = Graphics.FromImage(m)
gr.PageUnit = GraphicsUnit.Pixel
gr.Clear(Color.White)
gr.DrawEllipse(Pens.Red, Bounds)
gr.DrawLine(Pens.Blue, 0, 0, 100, 100)
gr.DrawLine(Pens.Blue, 100, 0, 0, 100)
gr.Dispose()
m.Dispose()
m = New Metafile(stream) 'break in here.
Dim bm As New Bitmap(100, 100)
gr = Graphics.FromImage(bm)
Dim dest_bounds As New RectangleF(0, 0, 100, 100)
Dim source_bounds As New RectangleF(0, 0, 100, 100)
gr.DrawImage(m, Bounds, source_bounds, GraphicsUnit.Pixel)
pic.SizeMode = PictureBoxSizeMode.AutoSize
pic.Image = bm
gr.Dispose()
m.Dispose()
|
|
|
|
|
There are so many problems with your code, I think I'll just rewrite it...
' Something to hold onto our memory stream
Private metaMemoryStream As New MemoryStream
Private Sub Button1_Click(blah, blah) Handles Button1.Click
Using g As Graphics = Me.CreateGraphics()
Dim hdc As IntPtr = g.GetHdc
Using meta As New MetaFile(metaMemoryStream, hdc)
Using metaGraphics As Graphics = Graphics.FromImage(meta)
'
' Draw your stuff here...
'
metaGraphics.Draw...
'
'
'
End Using
g.ReleaseHdc(hdc)
End Using
End Using
End Sub
Private Sub ShowMetaFile()
' VERY IMPORTANT!
' Make sure that we start at the beginning of the Memory Stream!!
metaMemoryStream.Seek(0, SeekOrigin.Begin)
PictureBox1.Image = Image.FromStream(metaMemoryStream)
End Sub
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
Yeah!!!
Thank you! Thank you! very much...
I have been confused many days about this problem until you taught me the correct way.
Really thank you again!
I don't know how to describe my happyiness.
|
|
|
|
|
I was wondering if anyone knows how to Read or communicate to/from a java applet. I'm an avid pogo player for some reason once i started i cant stop hehe. But i want to extract my token score, or even display the java game window in a win app. I am totally lost as to where to start, I can't find any tutorials on communication to java applets, or even how to display them in a certain language,
Is there any help someone can give me, and point me in the right direction.
It would be greatly appreciated,
Thank you.
|
|
|
|
|
Java applets run in their own runtime. There is no way to communicate directly with the applet unless it's written to expose a server, either through COM or TCP/IP. Getting the results out of the Java window, like your score, would involve OCRing the Java window! Java renders its windows without using any Win32 controls, so trying to use stuff like WM_GETTEXT on a window handle is useless.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
That is interesting and a good read on ocr
Is there an easy way to load the applet on a vb form?
|
|
|
|
|
Don't know - never tried. Never had a reason to.
I don't think there's a COM component you can put on your form to show a Java window.
You might want to checkout a Java-dedicated board for an answer to this one, like Sun's Support Forums[^].
The only thing I can think of would be to put a WebBrowser control on your form and have it navigate to the source of your Java code, be it a website or a file path.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
Dear Sir,
I am aware of vb, I have just started my vb.net session. In vb.net how can i write a code for saving data in to a database like sql 2000 server, and how to show the saved data into a grid( eg. Like an employee details)
vinay
|
|
|
|
|
Are you familar with SQL? If not, you should learn about that.
+look at the insert statement of sql to get the data in the database
+look at the select statement of sql to get the date out of the database
|
|
|
|
|
Dear nlarson11,
Thank you for your reply.
I know sql, i am using sql2000 server with vb. I want to know how to use store procedures in vb.net, and the connection syntax to connect database ,passing parameters into storeprocedures. Also i want to know how to display the data into a grid using vb.net. I am grateful to you if you give me some sample codes
thanks & regards
vinay
|
|
|
|
|
dim ds as dataset = (your method to run the stored procedure)
grd.datasource = ds
grd.datamember = ds.tables(0).tablename
|
|
|
|
|
dear nlarson11,
Thank you for your guidance.
I will try it and revert.
thanks & regards
vinay
|
|
|
|
|
how to backup sqlserver2000 database after sqlclient.sqlconnection made
from vb.net 2005
|
|
|
|
|
MohamedAdam wrote: how to backup sqlserver2000 database after sqlclient.sqlconnection made
Issue a proper TSQL BACKUP[^] command, using the same methods you would for any other SQL statement on your database.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
Hi ,
Iam using SSTAB for my Application in Visual Basic 6.0. Instead of clicking tab for "Selection", I want to select a tab using Mouse over a tabheader.
Please help me...
Thanks & Regards
Kumaran
|
|
|
|
|
kumaran...
i didnt understnd what u r asking... can u make it bit more clear for me? are u asking of selecting a tab just by pausing ur mouse over it?
|
|
|
|
|
Iam asking when we click the tab header only to select the different tabs know. Instead of clicking i want to select the tab when the mouse over of a particular tab headers.
Thanks & Regards
Kumaran
|
|
|
|
|
I wrote two functions to draw something like this.
__ __
_____
__ __
_____
__ __
_____
Have six lines and two kinds.
The Yao fuction draws ____ or __ __ and the DoubleGua one send a string like "010101" to Yao to draw lines.
However, I cannot draw six lines. Only one line show on my form.
Where am I wrong?
Can't this funtion run?
The function is as below:
Public Function DoubleGua(ByVal GuaIndex As String) As Bitmap
Dim Lx As Integer = 7
Dim myBmp As New Bitmap(40, 42)
Dim g As Graphics = Graphics.FromImage(myBmp)
Dim i As Byte
For i = 0 To 5
Dim Lpoint As New Point(Lx * i, 0)
Dim tmpyao As String = GuaIndex.Substring(i, 1)
g.DrawImage(Yao(tmpyao, Color.Black), Lpoint)
Next
Return myBmp
End Function
Public Function Yao(ByVal PorN As String, ByVal _Color As Color) As Bitmap
Dim myBmp As New Bitmap(40, 5)
Dim g As Graphics = Graphics.FromImage(myBmp)
Dim Guabrush As SolidBrush = New SolidBrush(_Color)
Select Case PorN
Case "0"
Dim rects As Rectangle() = {New Rectangle(0, 0, 18, 5), New Rectangle(22, 0, 18, 5)}
g.FillRectangles(Guabrush, rects)
Case "1"
Dim rects As Rectangle() = {New Rectangle(0, 0, 40, 5)}
g.FillRectangles(Guabrush, rects)
End Select
Return myBmp
End Function
|
|
|
|
|
astcws wrote: Dim Lpoint As New Point(Lx * i, 0)
You're offsetting the X coordinate, not the Y. This is drawing each line of your image on the same line, just moved to the right, not down. It should be:
Dim Lpoint As New Point(0, Lx * i)
Also, you MUST Dispose() your Graphics objects after you're done using them. You'll eventually get OutOfMemory exceptions if you don't, and/or you're system will start doing crazy things. If you create the Graphics object, you have the dispose of it. The same is true for Brush's, Pen's, and just about any other object that has a Dispose method.
Public Function Yao(ByVal PorN As String, ByVal _Color As Color) As Bitmap
Dim myBmp As New Bitmap(40, 5)
Dim g As Graphics = Graphics.FromImage(myBmp)
Dim Guabrush As SolidBrush = New SolidBrush(_Color)
Select Case PorN
Case "0"
Dim rects As Rectangle() = {New Rectangle(0, 0, 18, 5), New Rectangle(22, 0, 18, 5)}
g.FillRectangles(Guabrush, rects)
Case "1"
Dim rects As Rectangle() = {New Rectangle(0, 0, 40, 5)}
g.FillRectangles(Guabrush, rects)
End Select
g.Dispose()
Return myBmp
End Function
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
Yeah, what a stupid mistake?
As the method "disposed"...I really don't know it before...
Thanks very much.
|
|
|
|
|
Hello,
I am using a for loop to loop through the rows in a datagridview. I am using the index to control the loop. However, the loop always loops an extra time. For example, if i have 10 rows, it will loop 11 times. Is the index the wrong value to use in this case?
For Each dr As DataGridViewRow In Me.dgvPartByCategory.Rows<br />
componentID = Me.dgvPartByCategory.Rows(dr.Index).Cells("PartID").Value<br />
<br />
Next dr
Many thanks,
Steve
|
|
|
|
|
I hope this one will help u........
For Each MainGRD As DataGridItem In Me.dgrdmain.Items
'Use ur code here
Next
Regards,
Magi
|
|
|
|
|
Hi to everybody, The am Italian and The don'ts write very well in English. The have this problem that The don'ts succeed really to resolve: I owe to effect to login on to site and subsequently to donwload HTTP to two pages web that contains burdens information. The don'ts succeed in understanding whether to make the login and to preserve the "LOGON", that is in practice the login doesn't succeed me. The page of the site is : http://www.tre.it:80/selfcare/areaclienti133/4552_infoCosti_ITA_LOGGED.xsl. Thanks thousand and I pray you helped me
seven
|
|
|
|
|