|
You hit the nail on the head. I was trying with your code but with no success. Is this possible. If you could help I would be so greatful. This will make the program i'm working on work perfectly.
|
|
|
|
|
Add a command button.
Name it cmdSplit called split
Add 3 text boxes.
Name the first one txtFileName
Name the second one txtFile
Name the third one txtExtension
Private Sub cmdSplit_Click()
SplitFileNameOnDot (txtFileName.Text)
End Sub
Private Function SplitFileNameOnDot(sFileName As String)
Dim sChar As String
Dim sTemp As String
Dim sName As String
Dim sExtension As String
Dim bGotExtension As Boolean
Dim I As Long
For I = Len(sFileName) To 1 Step -1
sChar = Mid(sFileName, I, 1)
If bGotExtension = False Then
sExtension = sChar & sExtension
Else
sName = sChar & sName
End If
If sChar = "." Then
bGotExtension = True
End If
Next I
txtExtension.Text = sExtension
txtFile.Text = sName
End Function
Forever Developing
|
|
|
|
|
This is absoutly brilliant. My code is now finished. With out the help you gave me I don't know what i would have done. Wish I was a brainy as you.
Thank you so much
|
|
|
|
|
Is there any way that I can use the drag,drop effect for my scrabble game Im developing I want to drag a picture and drop onto a label and then show the picture in the target control that was previously in the sender?? Is there a way been searching for ages for help let me know please.....thanx!!
|
|
|
|
|
Here's how to drag an image back and forth between a couple of picture boxes:
Protected Overrides Sub OnLoad(ByVal e As EventArgs)
PictureBox1.Image = Image.FromFile("MyImage.bmp")
PictureBox1.AllowDrop = True
PictureBox2.AllowDrop = True
End Sub
Private dragSource As PictureBox
Private Sub PictureBox_MouseMove(ByVal sender As Object, ByVal e As MouseEventArgs) _
Handles PictureBox1.MouseMove, PictureBox2.MouseMove
'Initiate a drag if left mouse button is down
If e.Button = MouseButtons.Left Then
dragSource = CType(sender, PictureBox)
DoDragDrop(CType(sender, PictureBox).Image, DragDropEffects.Move)
End If
End Sub
Private Sub PictureBox_DragEnter(ByVal sender As Object, ByVal e As DragEventArgs) _
Handles PictureBox1.DragEnter, PictureBox2.DragEnter
If (Not dragSource Is Nothing) AndAlso (Not sender Is dragSource) Then
e.Effect = DragDropEffects.Move
End If
End Sub
Private Sub PictureBox_DragDrop(ByVal sender As Object, ByVal e As DragEventArgs) _
Handles PictureBox1.DragDrop, PictureBox2.DragDrop
If (Not dragSource Is Nothing) AndAlso (Not sender Is dragSource) Then
CType(sender, PictureBox).Image = dragSource.Image
dragSource.Image = Nothing
dragSource = Nothing
End If
End Sub
Hope this helps
Tom
|
|
|
|
|
hi all
i am currently working on winforms. i am facing a problem in resizing the window once it has been maximized.
Well i have a form with 2 buttons. one for maximising and the other for restoring the form to its original size/any specified size.
in the click event of the first button.. i set the forms's WindowState to FormWindowStae.Maximized. now when i click the second button i want to change the form size back to its original size before being maximized or to some size.i know i can restore the size of the form by using the restore button in the ControlMenu..i dont want to use it. i want to use the second button to do it. i tried setting new values to the Size property of the Form but is of no use.
can anyone please help me in finding as to how i can change the form's size once it has been maximized through code?
thanks and regards
|
|
|
|
|
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.WindowState = FormWindowState.Maximized
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.WindowState = FormWindowState.Normal
End Sub
Or did i miss read the question?
Hope this helps
Tom
P.S. can you delete your duplicate posting please?
|
|
|
|
|
Hi there.
I just finished decrypting a file and its in a buffer i created in memory. The problem i'm having now is that I want to run the process directly from memory and not copy the bytes to a file and run. Its unfortunate that the I can't find any Windows API functions that can do that or maybe there is a combination of functions that can effect that.. I don't know. Please i need help.. and fast. Thanks.
I'm using visual Basic 6 not .NET.
re
|
|
|
|
|
AFAIK, you can't in VB6. In C++, this is easily possible, but not ib VB6. I haven't seen any API that allow you to change the program exection like that.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
So if its not possible in VB6, then what. I can't program in C++. Help me out.
|
|
|
|
|
I hate repeating myself -> It's not possible to do in VB6!
After further consideration, you have a second problem though...
If you decrypted an .EXE file, you can't just jump to the file in memory. It must be read and processed by the Loader in Windows. You used to be able to do this with .COM files because they are "memory image" files. What's in the file is exactly what get loaded into memory. .EXE files are not like this at all. They are segment processed and loaded sections at a time and must be setup in memory before the starting point is jumped to.
There is no API function that will process and load the file from memory, only from a valid .EXE. So, the only solution you have is what you're already doing.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
can anybody be able to help me in creating a interactive voice responce system in vb.net(using modem).
geo
|
|
|
|
|
|
I am using vb6 to develop a client server applications. At installation site there are nearly 50 pcs using the application which is installed on each pc. But when there are changes in the application and a new executable file is prepared I need to install it again on all the pcs. Is there any way by which i can install the executable file on all the pcs instead of physically going to each pc ? or can i share the executable file that resides at a centralized location ? Please help me out
SL Tan
|
|
|
|
|
You could place the Exe on a centeralized location. Like a server. Then map a drive to that folder on each of the PC's. Then update you short cuts to point to the mapped drive. This way when a new exe comes out all you have to do is replace the one exe. Also you will need to install all of the exe's dependancies on the other machines.
NOTE: if the app has per user settings that are saved to a ini file, those settings need to be saved in a unique manner for each user. This can be solved in a number of ways.
Forever Developing
|
|
|
|
|
Hi all,
i am writing an IDE like visual studio .Net. i want to produce the same effect as vs.net provide like when you drag and drop a control on a form it appears and if you want to adjust the location of this control you can use the mouse to drag and drop it to any location. i have successfully done every thinig accept that the selection frame. on my mousedown event when selection frame is drawn it goes behind and hides. i want to take it on top i mean it should not hide behind any control instead it should be the top most element when user is grabbing it and moving her mouse. can any body help in this regard. tested code will be plus for me .
Thnx.
|
|
|
|
|
Hi All,
Im designing an complaints application on VB.Net,
Im trying to make the Tab Moves from one field to another when i Press
Enter Key,
any One can help,
If anybody know's sites for free VB.Net code in Order to Learn More and More
Thanks in Advance
Loolita
|
|
|
|
|
Trap the keypress and if it's the enter key move to the next control:
Private Sub TextBox1_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyUp
If e.KeyCode = Keys.Enter Then
MyControl.Focus()
End If
End Sub
Hope this helps
Tom
|
|
|
|
|
Good Day,
Thank you Very much it realy Wroks,
Just i have a wonder whether we can put such Code on the Form Level,
if e.keycode=keys.enter then
" focus=focus.nextfield",this what i mean.
in order not to put the same code for each control.
|
|
|
|
|
I have applied a similar solution.
However, every time I press the enter key everything works ok BUT the system gives a beep sound.
Does anyone know why this is and how to stop it?
Thanks
|
|
|
|
|
No panic!!!
This was resolved by the following:
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If e.KeyChar = Chr(13) Then
TextBox2.Focus()
e.Handled = True
End If
End Sub
|
|
|
|
|
hello
i wish program a button that will move another button to a specific location
i try to make it more simple
there are 2 buttons A & B
when button A is pressed, button B will move away from button A so that button A's sub button could be display
i can manage the sub button part but was unable to move button B to a specific location because i dont know the coding that will do the task
can you please help me?
if this type of program or coding is impossible, please tell me, so i can drop my intention to do this function.
thank you in advance
p.s. below is a visual example of the thing i wish to do
"before button A is clicked"
Button A
Button B
"after button A is clicked"
Button A
Button B
Gary
|
|
|
|
|
I do not syntax of VB.Net, but in C# the above can be done as below
this.button2.Location = new Point(this.button2.Location.X, this.button2.Location.Y + 10);
Read about the Location Property of the class System.Windows.Forms.Button on msdn, This property is being inherited from Control . You get all relevent details.
Best of luck.
Regards,
Jay
|
|
|
|
|
dear gary it is very simple in .net. if i would have been at your place i should do it in this manner.
place button A then place a textbox with multiline property set to be true also make it invisible now put a new button button B. leave it i m giving you the entire code use it and remember me in your prayers.
Public Class FrmMoveButton
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents Button2 As System.Windows.Forms.Button
<system.diagnostics.debuggerstepthrough()> Private Sub InitializeComponent()
Me.Button1 = New System.Windows.Forms.Button
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.Button2 = New System.Windows.Forms.Button
Me.SuspendLayout()
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(4, 14)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(112, 28)
Me.Button1.TabIndex = 0
Me.Button1.Text = "Button1"
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(6, 44)
Me.TextBox1.Multiline = True
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(110, 48)
Me.TextBox1.TabIndex = 1
Me.TextBox1.Text = "please provide co-ordinates in (x,y) format dont forget paranthasis"
Me.TextBox1.Visible = False
'
'Button2
'
Me.Button2.Location = New System.Drawing.Point(6, 44)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(110, 30)
Me.Button2.TabIndex = 2
Me.Button2.Text = "Button2"
'
'FrmMoveButton
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 273)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.Button1)
Me.Name = "FrmMoveButton"
Me.Text = "FrmMoveButton"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox1.Visible = True
Button2.Location = New System.Drawing.Point(TextBox1.Location.X, TextBox1.Location.Y + TextBox1.Size.Height + 10)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim loc As New System.Drawing.Point(0, 0)
Dim arr(2) As String
Dim str As String
Try
str = Microsoft.VisualBasic.Mid(TextBox1.Text, 2)
str = Microsoft.VisualBasic.Left(str, str.Length - 1)
arr = Microsoft.VisualBasic.Split(str, ",")
Button2.Location = New System.Drawing.Point(CInt(arr(0)), CInt(arr(1)))
Catch ex As Exception
MsgBox("I think you ddnt provide the value in form (x,y)")
End Try
End Sub
End Class
|
|
|
|
|
wow....
thanks ehmed..i will dream hahaha
sorry for the late reply....
my motherboard got fried
i will try out this code
thanks again
Gary
|
|
|
|