|
Check out the System.Drawing.Graphics namespace
for example :-
Dim oGraphics as System.Drawing.Graphics = Me.CreateGraphics<br />
Dim oPen as New Pen(Color.Blue, 10)<br />
oGraphics.DrawLine(oPen, 45, 45, 95, 95)<br />
oGraphics.DrawArc(Pens.Green, 8 ,10 ,30, 30, 90, 180)<br />
<br />
Dim oBrush as New SolidBrush(Color.Purple)<br />
oGraphics.FillRectangle(oBrush, 100, 100, 50 ,50)<br />
oGraphics.FlllEllipse(Brushes.Orange, 10 , 10, 30, 30)<br />
Steve Jowett
|
|
|
|
|
hmm does it have the values that the user give
|
|
|
|
|
Hi,
I am adding text to a text file but I don't want to have any duplicates. I am searching a system for files and if the file occurs twice I only want it added once to the text file.
If any one can help it would be great.
Thanks
|
|
|
|
|
johnjsm wrote: Hi,
I am adding text to a text file but I don't want to have any duplicates. I am searching a system for files and if the file occurs twice I only want it added once to the text file.
If any one can help it would be great.
Thanks
There are many ways of implementing this...
You could write it to a database table and check if it already exists (probably the easiest method)
You could create a tree structure or some kind of sorted array in memory and search in it...
|
|
|
|
|
I agree with Chandra. The text file is just a place to store stuff when your app isn't running. So, do your work in memory, then write the end result to the file when your done. Don't try to work with it in the file itself.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
hi,
i am looking for code example for saveing data to database.
i have recordset as datatable in .net and now i want to save this datatable records to the
database on sql server so how this is possible.
please tell me with code so i working on that way.
i use like this code also. "insert into saleitm select * from datatable"
but its giving me error
so tell what i do.
mitesh
mitesh_pattani@rediffmail.com
|
|
|
|
|
mit2223 wrote: i use like this code also. "insert into saleitm select * from datatable"
but its giving me error
What error? Are the structures of both tables the same??
|
|
|
|
|
It would help if you knew SQL before you try to write code to do it for you. Might I suggest something from the menu[^]?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Dave Kreskowiak wrote: Might I suggest something from the menu
Hmmm, SQL cookbook might have some nice entrees in it
If you try to write that in English, I might be able to understand more than a fraction of it. - Guffa
|
|
|
|
|
Hi
I have this C# code I wrote that I'd like to implement in a VB.NET project:
<br />
using System;<br />
<br />
public class PairTT<T1, T2><br />
{<br />
public T1 First;<br />
public T2 Second;<br />
<br />
public PairTT(T1 first, T2 second)<br />
{<br />
this.First = first;<br />
this.Second = second;<br />
}<br />
}
I tried this in VB.NET:
Public Class PairTT(Of T1, Of T2)<br />
End Class
But VS2005 complains about the second "Of" saying "Keyword is not valid as an identifier".
Any help with this would be greatly appreciated!
|
|
|
|
|
Got it:
Public Class PairTT(Of T1, T2)<br />
<br />
End Class
Easy when you know how!
|
|
|
|
|
You should be using the Of keyword at all. Your arguments, in the C# code, are being passed by value, so...
Imports System
.
.
.
Public Class PairTT
Public First As T1
Public Second As T2
Public Sub New(ByVal first As T1, ByVal second As T2)
Me.First = first
Me.Second = second
End Sub
End Class
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Thanks Dave, but damn I pasted the wrong C# code into my first example, I should have pasted this (the class-level typeparams disappeared because they contained HTML angle brackets):
[Serializable]<br />
public class PairTT<T1, T2><br />
{<br />
public PairTT(T1 first, T2 second)<br />
{<br />
this.First = first;<br />
this.Second = second;<br />
}<br />
<br />
public T1 First;<br />
public T2 Second;<br />
}<br />
How would I implement this in VB? I think my 2nd post answers what I should have asked for originally, but thanks again for any help!
|
|
|
|
|
how I make virtual com port to my usb port?
simple can help thanks.
|
|
|
|
|
You don't. The device you want to talk to has to have drivers that exposes it AS a COM port. USB really has nothing to do with it.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Check if the USB device you want to use already acts as a com port. My "USB GPS" work as a COM thru a USB port, I was lucky. If not, you can buy a USB to COM port adapter. That also works for me on an other device I use.
Hope this helps.
Rob
|
|
|
|
|
i'm really enjoying the simplicity in how to pull data in vb.net 2005
i've got a data source (pointing to an access db),
i throw a few controls in my form, i open that cute database designer
add my query which selects various fields from a table WHERE (ID=?)
and voila, i can pull data in my program.
but now i don't want to get data "where id = ?" only, but i want "where id = ? or id = ? or ..."
so i tried "WHERE (?)" but u arent allowed to pass sql code, only parameters. (obvious)
in other words i want to be able to easily execute my own sql statement.
does anyone know the easiest, least painful way to do this ?
(that is without going into connecting to the database, declaring a gazzilion things just to execute 1 line of sql, and pass them back to a datatable type)
-- modified at 8:10 Tuesday 19th December, 2006
|
|
|
|
|
ad3z wrote: i'm really enjoying the simplicity in how to pull data in vb.net 2005
i've got a data source (pointing to an access db),
i throw a few controls in my form, i open that cute database designer
add my query which selects various fields from a table WHERE (ID=?)
and voila, i can pull data in my program.
That's nice and all, but the "wizards" make it a large PITA to support the resulting code. If you want TOTAL control over the database code and develop a good understanding of how it all works and fits together, it's a good idea to scrap the wizard generated stuff and write it by hand.
ad3z wrote: but now i don't want to get data "where id = ?" only, but i want "where id = ? or id = ? or ..."
so i tried "WHERE (?)" but u arent allowed to pass sql code, only parameters. (obvious)
Now you know why I said what I did. If you search your code for the query you put into the wizard, you can usually modify the query string to what you want. The problem is that you are now adding multiple parameters to the query string and will have to modify more code to add those parameters.
ad3z wrote: does anyone know the easiest, least painful way to do this ?
Scrap it and write it from scratch.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I don't think the code is exact for an access database, but if it where sql, as a part of your data connection you apply the member variable.
<br />
Dim Sql1 As String<br />
<br />
sSql1 = " Select * where id like '%'"<br />
<br />
'connection<br />
"osql -S " & [Server] & " -d " & [database] & " -U [User] -P [Password] " & "-Q """ & sSql1 & """" & " -n -o """ <br />
|
|
|
|
|
well i manage to connect to it but it's alot of code, and
it looks like i set up another connection (apart from the one i'm activly using with
the .net components)
i have to declare oledb connection strings
connect to it (add the fact it's got security blah)
read it to a dataset
specify my sql command
execute the command into a new dataset
and then use datatables and datarows to access it
isn't there a simpler way ?
that what i'm looking for
(something in the lines of the new ado.net help thingys)
Ericos Georgiades
|
|
|
|
|
Trying using the datagrid control. After you follow the wizard setting up the connection you have the option of changing your query. You can also add additional queries with buttons to run the specific query.
|
|
|
|
|
"the specific query"
yeah i dont want to run pre-defined queries cause i cannot specify my criteria freely.
i want to return to a table all the rows of a table
given a selection of parameters
for instance, if a listbox shows me all the customers and i select 4 of them, i'd like to
have a table as datatable which has the rows of the sales table which match the 4 customers i chose.
with the wizard i can only predefine the criteria
anyways it doesnt seem as though there is a simpler way rather than writing the entire connection string
oh yeah and i know, i talk alot... :P
Ericos Georgiades
|
|
|
|
|
I want to read data from USB IR receving device.
|
|
|
|
|
Then it's probably exposed as a COM port (Serial port). You'll have to check with any documentation you got with the device or the machine. Google for "VB.NET Serial Port" and you'll come up with all kinds of stuff on it, that's IF it's exposed as a serial device.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Keep your posts in the same thread. Don't start a new thread just because you have something need to say about the old one.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|