|
Pretty much all the API calls can be called from VB.NET - but because the framework provides about 90% of the functionality of the API it is prefereable to look therein first.
Do a search in the help on <DLLImport()> attribute and look at the System.Interop namespace
'--8<------------------------
Ex Datis:
Duncan Jones
<a href="http://www.merrioncomputing.com">Merrion Computing Ltd</a>
|
|
|
|
|
a) I have some question about .Net Data Grid Control like how could I assign ‘n’ of empty rows to datagrid when I will click on a button.
b) How could I get Row and Column position when I will click on a specific cell?
c) How could I get the value when I will click on a specific cell?
d) How could I assign value to a specific cell when I will click on button?
e) How could I get Cell top, Cell left, Cell width, Cell height when I will click on a specific cell?
f) How could I assign 0 to a specific column width?
All the properties are available for flexgrid. So please tell me answers of all my question of .Net Data Grid and also provide sample class.
tbhattacharjee
|
|
|
|
|
|
I often use FlexGrid in Visual Basic to take multiple input from user.let me give you a example say suppose at the time of form load form will have 100 rows and two column
When I will click on any cell of first column then on that column textbox will appear
And When I will click on any cell of second column then on that column combo box will appear in this way I will take multiple input from user and save those input in table.
In vb.net I tried to work with FlexGrid which is com control all the property of FlexGrid
Is working well but when I try to design same thing which works fine in vb but I got problem in vb.net. Let me tell you what I designed in vb.net. In vb.net project I have one form and I took FlexGrid which is com control and a textbox and a combo box which is
.net control and I apply the same logic which work very well .the logic is when I will click on any cell of the first column of FlexGrid then text box will appear in that cell and when I will click on any cell of the second column of FlexGrid then combo box will appear in that cell. In vb.net textbox and combo box moving perfectly but does not appear on any cell of FlexGrid that is my problem. If any body can solve the problem then please let me know every thing in detail step by step and sample code also I will be highly obliged. My doubt is in my vb.net project .I have taken a FlexGrid com control and other two textbox and combo box is .Net control it could be reason that why textbox and combo box is moving to the right place but does not appear on cell of FlexGrid. Please help me some one to achieve my output.
tbhattacharjee
|
|
|
|
|
I can't use API Function SearchPath in VB.Net. Help me.
|
|
|
|
|
I'm writing a console app that when the user types in a number it gets stored into an arraylist. When they type in certain commands it does misc. things, therefore the input is set to string. However if they type an invalid string that is not one of the preset commands or an integer I want to give them an error message. The issue I'm running into is checking wether the string is an integer or not. If someone can point me into the right direction I would appreciate it.
Thanks in advance. :>
To see one's self from another's point of view is an opportunity not to be passed up.
|
|
|
|
|
Try using Int32.Parse()
This function converts a string into a Int32 type.
You can find more info in Help
Free your mind...
|
|
|
|
|
I need extract audio in mp3 format from video files (avi or mpeg).
How can i do this ?
Thanks
|
|
|
|
|
Can anyone help.
I am trying to create an SQL statment and in the WHERE clause the text being searched for has a ' in.
For example
"SELECT * FROM [computer list table] WHERE [Computer Owner] = Damian's computer"
The problem i am having is with the Damian's Computer. It seems to get upset with the '
Any help would be much appreciated
|
|
|
|
|
Use 2 '' instead...
"SELECT * FROM [computer list table] WHERE [Computer Owner] = Damian''s computer"
Free your mind...
|
|
|
|
|
I usually creates a function PadApostrophe(strText as string) which will replace every single instance of ' with '' (two single quotes).
But recently I read this is not a very good way to do it, so if you're using SQL command object you can pass parameters instead and you don't need to replace the '.
Hope this helps!
|
|
|
|
|
|
Here is what I do.
I create a constant called QUOTES as below.
Const QUOTES = """"
I then create a function called SQLstring as below.
Public Function SQLstring(StringIn as String)as String
SQLstring = QUOTES & StringIn & QUOTES
End Function
So now if I want write an SQL statement that needs a string within a string, I do the following:
Dim SQL as String
Dim State as String
State = "CA"
SQL = "SELECT * FROM Table WHERE State = " & SQLstring(State)
The resulting SQL will be as follows:
SELECT * FROM Table WHERE State = "CA"
Is this what you are looking for?
|
|
|
|
|
I'm working on a vb app that I would like to connect to an ftp server and execute a few predefined commands. Basically what I'm looking to do is connect daily and d/l a file. I couldn't find anything in the codebank for vb.net, so I'm asking here.
Also, I'll be adding a feature that connects to a telnet server and executes a set a predefined commands as well, I would think the solution to the first problem will also solve this one.
I've read through my books but can't seem to figure out what to use to do what I want. Any help is appreciated.
Thanks.
|
|
|
|
|
For the FTP portion - check out the article and code by Alex Kwok
I reference his C# component in my VB app and use it regularly. I've had to make a few changes to account for odd directory listings but even though I'm not a C# programmer I had no problems with it.
|
|
|
|
|
Hi,
Im trying to write an app to do this but im not sure were to start. I need some pointer on:
Opening and reading binary file
moveing to specific part in the file so i can extract the data.
Cheers
Lukey
|
|
|
|
|
|
Hi,
I want to create an application, which constantly listen to the traffic on a Windows 2000 server. The purpose is to monitor 8 of the computers on the network to control the time users spend on the network via these machines.
The purpose is that the students (it is on a school) can use these 8 machines very much like computers in an Internet cafe. The students should be granted 15 minutes each within a 2 hour period. After the 2 hours they get another 15 minutes available. The 15 minutes time slot should be flexible, as the user should be able to choose when or whether he/she wants to use it.
I have never created such an application before, or even touched the subject, as my programming experience is quite limited.
Can someone please give me some hints on how this can be done. Or even better, submit some source code, which can perform such a task.
My initial idea is that I can create an application that constantly monitor the traffic from these 8 computers using their IP or MAC address to identify them, and make a simple log using Access. If a user tries to log on and their given time slot has been used, the application just blocks any traffic to that computer until a legitimate user logs on.
Is this the way to go?
I'll be happy for any comments...!!!
Thanks in advance,
N.
|
|
|
|
|
I'm writing an app that opens an image file, converts it to a gif, sets it transparency and then resizes it. Everything works fine until I resize the image (The transparency is lost and is replaced with black pixels). The reason is that to resize the image I am doing a matrix transform and drawing the image onto a new image. When it draws onto the new image it loses its transparency information (I think this is because the image I am getting does not have the right colour depth). I could apply the transparency after resizing but this leaves 'fuzzy edges'. Does anybody have any ideas how I could achieve drawing an image with transparent areas onto a new image.
If anyone can help that would be great, I could mail the entire code if necessary, would have posted it here but its too long.
Here is a small section the code:
<br />
Private Sub ResizeImage(ByVal filename As String, ByVal Width As Integer, ByVal height As Integer)<br />
Dim oSourceImage As Bitmap<br />
Dim tmpBmp As Bitmap = CType(Image.FromFile(filename), Bitmap)<br />
Dim IsAlpha As Boolean = Image.IsAlphaPixelFormat(tmpBmp.PixelFormat)<br />
If IsAlpha = False Then<br />
oSourceImage = New Bitmap(tmpBmp.Width, tmpBmp.Height, PixelFormat.Format32bppArgb)<br />
Dim g As Graphics = Graphics.FromImage(oSourceImage)<br />
g.DrawImage(tmpBmp, 0, 0)<br />
g.Dispose()<br />
tmpBmp.Dispose()<br />
Else<br />
oSourceImage = tmpBmp<br />
End If<br />
<br />
'Dim oSourceImage As Image = TransImageUtility.SetTransparentColour(Image.FromFile(filename))<br />
If Not ((oSourceImage.Width <= Width) And (oSourceImage.Height <= height)) Then<br />
Dim oResizedImage As New Bitmap(Width, height, PixelFormat.Format32bppArgb)<br />
Dim oGraphic As Graphics = Graphics.FromImage(oResizedImage)<br />
oGraphic.CompositingQuality = CompositingQuality.HighQuality<br />
oGraphic.SmoothingMode = SmoothingMode.HighQuality<br />
oGraphic.InterpolationMode = InterpolationMode.HighQualityBicubic<br />
Dim oRectangle As New Rectangle(0, 0, Width, height)<br />
'********************************<br />
Dim largestRatio As Double = Math.Max(CDbl(oSourceImage.Width) / Width, CDbl(oSourceImage.Height) / height)<br />
Dim posX As Single = CSng(Width * largestRatio / 2 - oSourceImage.Width / 2)<br />
Dim posY As Single = CSng(height * largestRatio / 2 - oSourceImage.Height / 2)<br />
Dim mx As New Matrix(1.0F / CSng(largestRatio), 0, 0, 1.0F / CSng(largestRatio), 0, 0)<br />
mx.Translate(posX, posY)<br />
oGraphic.Transform = mx<br />
oGraphic.DrawImageUnscaled(oSourceImage, 0, 0)<br />
'********************************<br />
oSourceImage.Dispose()<br />
oResizedImage.Save(filename, ImageFormat.Gif)<br />
End If<br />
End Sub
Jim
|
|
|
|
|
I can think of two ways. Either you could handle the controls' GetFocus event, and keep track of which control has the focus using a member variable. Alternatively, you could iterate through the form's Controls collection and call Paste on the control whose Focused property is True .
The first option requires a little overhead when the focus is changed; the second requires a bit more overhead when the Paste function is used. If you don't have many controls on the form, the latter is probably a better solution.
|
|
|
|
|
Hi Mike
Thanks for your comments.
Yeah, I have tried the second way, but it didn't work to well.
It just pasted the text to all the textboxes.
I did consider doing it the first way as well, but thought that there must be an easier way of implementing it.
I'll give it another go when I get in.
Cheers,
Dan
|
|
|
|
|
I'm trying to learn and have a problem selecting an author from the combo box and pulling up that particular authors book info in a datagrid.
Can someone please help on the Selected Index changed to pull up info in
data grid. I can't bind them together.
Would appreciate so much!!!!!!!!!!!!!!!!! Alex
Below is code:
'Call up authors name in combo box
cmdAuthors.CommandText = "Select au_id, au_fname + ' ' + au_lname as name From authors"
cmdAuthors.CommandType = CommandType.Text
cmdAuthors.Connection = conPubs
conPubs.Open()
'cboAuthors.DataTextField = paraName.Value
daAuthors.Fill(dsPubs, "Authors")
conPubs.Close()
'show the names in the combo box
cboAuthors.DataSource = dsPubs.Tables("Authors")
cboAuthors.DataTextField = "name"
cboAuthors.DataValueField = "au_id"
cboAuthors.DataBind()
End Sub
Private Sub cboAuthors_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cboAuthors.SelectedIndexChanged
Dim conPubs As New SqlConnection("Server=alex; Database= pubs; UID= sa; PWD= ")
Dim cmdTitles As New SqlCommand
Dim drTitles As SqlDataReader
Dim daTitles As New SqlDataAdapter(cmdTitles)
Dim dsPubs_Titles As New DataSet
cmdTitles.CommandText = "Select title, title_ID, pub_id, pubdate From Titles Where authors.au_id = titles.title_id ORDER BY titles.title"
cmdTitles.CommandType = CommandType.Text
cmdTitles.Connection = conPubs
If Not IsPostBack Then
conPubs.Open()
End If
dgTitles.DataSource = dsPubs_Titles
drTitles = cmdTitles.ExecuteReader
dgTitles.DataSource = drTitles
dgTitles.DataBind()
daTitles.Fill(dsPubs_Titles, "Titles")
conPubs.Close()
End Sub
End Class
|
|
|
|
|
how to shutdown windows from vb .net application thx
|
|
|
|
|
I am trying to parse the quotation marks from a string that is returned from an inputbox and then "shell" to the console.
Here is my code.
Dim FileName As String = InputBox("Please enter the file name here")
Shell("c:\program files\d-tools\daemon.exe" & " -unmount 0 ")
Shell("c:\program files\d-tools\daemon.exe" & " -mount 0," & FileName)
End Sub
Just to clarify this is a console app.
Any help would be great!
Thank
I'm just a simple man with complex issues.
|
|
|
|
|
I'm not sure what your looking for. What do you mean by parse? What is the end result supposed to look like?
<br />
Dim FileName As String = InputBox("Please enter the file name here")<br />
Shell("c:\program files\d-tools\daemon.exe" & " -unmount 0 ")<br />
Shell("c:\program files\d-tools\daemon.exe" & " -mount 0," & FileName)<br />
The InputBox looks OK. If the user types (WITH quotes): "C:\Program Files\Stuff.txt", that exact string will be passed in the Shell statement. The 2nd shell command will look exactly like this:
<br />
c:\program files\d-tools\daemon.exe -mount 0,"C:\Program Files\Stuff.txt"<br />
If that's what you want passed to the Shell, then you don't have any problems...
BTW: What's with the '&' your using right after the daemon.exe? You don't need it there. Just to make the code a little more readable, you might want to take those out, but keep the one in front of 'FileName'.
RageInTheMachine9532
|
|
|
|