|
How can I add system installed fonts in my combo box?
I also want to add color names in another combo box.
How can I show image in textbox if not through which tool i can add a text line & after that line an image. (like messenger, in which we enter any line & then smilly)
|
|
|
|
|
sam_pune wrote:
How can I add system installed fonts in my combo box?
There's a description of how to enumerate the installed fonts here[^] on MSDN.
sam_pune wrote:
I also want to add color names in another combo box.
Is there something wrong with ComboBox1.Items.Add("colorName") ? Or what are you looking for here?
sam_pune wrote:
How can I show image in textbox
You can't. TextBox doesn't support images or hosting other controls.
RichTextBox will support images though. There's an article by Khendys Gordon that demonstrates who to do this here[^] on CP. It's written in C#, but is easily convertable to VB.NET.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hello
I'am trying to copy a folder to another drive. I'am doing this with the FileSystemObject fso. Now, I want that the progress of the copying is shown in a Progressbar. All that I get is that first the folder is copied and then the progressbar is shown. I'd like to have it at the same time.
Please excuse my English. I'm not used to speak it very often, but I can understand most of it.
Any help would be greatly appreciated.
Here is the code for copying the folder:
<br />
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click<br />
<br />
Dim md As String<br />
Dim di As String<br />
md = "C:\Eigene Dateien"<br />
di = "Laufwerk \i:"<br />
<br />
timer1.enabled = true<br />
<br />
Label1.Text = "Achtung: Datentranfer läuft. Bitte warten."<br />
Label1.Refresh()<br />
<br />
Dateien_Kopieren()<br />
<br />
Label1.Text = "Kopiervorgang ist abgeschlossen"<br />
MessageBox.Show("Der Ordner " & md & " ist nach " & di & " kopiert.")<br />
<br />
End Sub<br />
<br />
Private Sub Dateien_Kopieren()<br />
Dim fso As FileSystemObject<br />
<br />
fso = CreateObject("Scripting.FileSystemObject")<br />
<br />
fso.DeleteFolder("i:\Eigene Dateien", True)<br />
<br />
fso.CopyFolder("C:\Dokumente und Einstellungen\Christoph Schmid\Eigene Dateien", "i:\")<br />
<br />
End Sub<br />
Other controls on the form are a progressbar and a timer.
<br />
Private Sub Timer1_Tick()<br />
progressbar1.value = progressbar1.value + 1<br />
End Sub<br />
|
|
|
|
|
|
Thanks for the link
I'm sorry, I didn't say that I want to do the code with VB.Net. I don't have VS6 installed any more, but I have transformed the code from the link into VB.Net-code but I have several problems debugging it. I have seen many useful examples with a Progressbar in this forum, but I didn't find what I was looking for.
Thanks
|
|
|
|
|
In order for a Progress Bar to work, you need two things. You need to know how much work your doing (total number of files or total size of all files) and a mechanism to report how far you've gotten through that work. Using the FileSystemObject .CopyFolder method won't give you either of those.
In order to get the total amount of work to be done, you'll need to either count the number of files in the source directory (and all subdirectories) or the number of bytes in those files. Either way, the data collection method is the same. Use a recursive function, that takes a full fileystem path as a parameter and returns the total number of files/bytes in that folder and all subfolders, to enumerate all the files in a folder, then call itself with the path to each one of the subdirectories, one at a time.
Now, copying the files follows the same rescursive method, but it updates the Progress Bar with how many files/bytes have been copied. If you're counting files, then all you need to do is call File.Copy with the full path to the source and destination filenames. Update the Progress Bar after each file copy is completed. If you're counting bytes, that gets a little more complicated. But just write your own Copy function that takes the same file path parameters for source and destination. This function will then have to open the source file (Binary mode preferrably), read a block of bytes and copy them to the destination file. Update the Progress Bar with the number of bytes that have been copied.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks for your reply
I will try to write a code using your suggestions. I hope I can do it. I'im still a beginner in VB.Net.
|
|
|
|
|
I got Application Error Msg when I close the software:
"The exception unknown software (0xc0020001) occured in the application at location 0x7c81eb33."
Anyone has encountered this before? Please help me.
Thanks.
|
|
|
|
|
How can I setup a form so it fits to the choosen paper size (A4). Form1.Heigth and Form1.Width can't do the job alone. Thank you in advance.
Palle Jensen
|
|
|
|
|
Hi there! I am a newbie to this VB.NET language. I am trying to make a datatable that pulls from a database and populates a datatable with certain information. However I am receiving the following error and I don't know what to do about it. "System.NullReferenceException: Object reference not set to an instance of an object." Here is the section of my code that it causing the error
Dim myService As CalWebServiceVB.CalWebServiceVB
' Create variables for DataTable
Dim myDataSet As DataSet = New DataSet
Dim dtblCal As DataTable
Dim dcolCal As DataColumn
Dim drowCal As DataRow
dtblCal = New DataTable("New Calendar")
' Number of days to retrieve from Calendar and Name of Calendar
Dim CalName As String = "Academic" 'Request.QueryString["CName"];
Dim numdays As Integer = 45 'Convert.ToInt32(Request.QueryString["CDays"]);
Dim numcount As Integer = 4
Dim output As String
output = "Number of elements in a table "
'output += (myService.GetEventsTable(CalName, numdays).Rows.Count())
Console.WriteLine(output)
numcount = myService.GetEventsTable(CalName, numdays)
This is the line on which I get the error "numcount = myService.GetEventsTable(CalName, numdays)". The method call myService.GetEventsTable(CalName, numdays) calls a method that returns the number of rows in this table as an integer. Any help that could be tossed my way would be great. Thanks
|
|
|
|
|
I have no idea what the CalWebServiceVB is, but it looks like the first line of the code you posted should have been:
Dim myService As New CalWebServiceVB.CalWebServiceVB
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
O yes the little that stop my code. It works just fine now. Thanks a million
|
|
|
|
|
i checked for the pressed key in the keyboard, and i got what i want
but i want to get the status of the capslock(on or off) when it is pressed in vb.net
|
|
|
|
|
hello use the API function
declare function GetKeyBoardStatus(nKey as VirtualKeyCode) as Long
|
|
|
|
|
I'm developing a small VB.NET WinForms application which will be aware of the user connecting a USB memory drive og external harddrive.
Is it possible to get a notification/event when a drive letter is mounted and dismounted from the system ?
Thanks in advance
|
|
|
|
|
http://www.codeproject.com/dotnet/devicevolumemonitor.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/devio/base/wm_devicechange.asp
|
|
|
|
|
One more in VB.Net:
http://www.lvr.com/hidpage.htm#MyExampleCode
http://www.lvr.com/files/hidclass.zip
|
|
|
|
|
Greetings All,
I am having trouble with a concept in VB.NET. I am trying to write and accessor property in a form so that I can change the text of a textbox from a subroutine in a class that I have written. However I cannot seem to get to the accessor property for the form within the class. Is this not possible? Here is the code for the property and the class. The class is instantiated in the form.
Form Code
Imports System.Threading
Public Class Form1
Inherits System.Windows.Forms.Form
Dim i As Integer
Dim clock As New Ticker
Dim cb As New TimerCallback(AddressOf clock.Tik)
Dim timer As Timer
#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 Button2 As System.Windows.Forms.Button
Friend Shared WithEvents txt1 As System.Windows.Forms.TextBox
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
<system.diagnostics.debuggerstepthrough()> Private Sub InitializeComponent()
Me.Button1 = New System.Windows.Forms.Button
Me.Button2 = New System.Windows.Forms.Button
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.SuspendLayout()
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(8, 4)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(106, 44)
Me.Button1.TabIndex = 1
Me.Button1.Text = "Start Timer"
'
'Button2
'
Me.Button2.Location = New System.Drawing.Point(120, 4)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(106, 44)
Me.Button2.TabIndex = 2
Me.Button2.Text = "Stop Timer"
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(14, 56)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(208, 20)
Me.TextBox1.TabIndex = 3
Me.TextBox1.Text = ""
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(242, 87)
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.Button1)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
timer = New Timer(cb, Nothing, 0, 1000)
End Sub
Public Property setText() As String
Set(ByVal Value As String)
TextBox1.Text = Value
End Set
Get
Return TextBox1.Text
End Get
End Property
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
timer.Dispose()
txt1.Text = "Timer Disposed"
End Sub
End Class
Class Code
Imports HWINTERFACELib
Public Class Ticker
Dim i As Integer
'Dim hw As New HwinterfaceClass
Public Sub Tik(ByVal obj As Object)
i += 1
'hw.OutPort(&H400, 62)
Form1.setText = i.ToString ' <--- doesn't work?
End Sub
End Class
Thanks in advance
|
|
|
|
|
Hi! I don´t think you have access to the form that class. From the top of my head i see a way (there are others i'm sure):
Use delegates. When you create the object from class ticker pass it a reference to the function setText.This reference can be used to initialize your delegate. If the object will execute in another thread (other than the UI thread) it's better to use also Me.Invoke(...);
Never say never
|
|
|
|
|
I'm trying to create a IMAP client and can't seperate my attachments from my message body- can anyone please help?
|
|
|
|
|
Hi guys im having problems playing videos mpeg files
basically im using mci sound to do this. At the moment I can play mp3, wav and other audio types but.. Im abit stuck on playing videos...I need help on how this is dun if anyone can give me a small example that would be great
Thank you doh:
|
|
|
|
|
Hello there
I have created an application with help file. When I press F1 it comes fine on every form . The problem is coming when I am opening a Dialog Form then on pressing F1 the help opens but not activated. infact form remains on top . to view the help window you need to click on the task bar to select the help file.
Any suggestions to get the focus on the help window directly.
I have tried to load the form by two ways but no difference
1. FormName.showDialog(Me) ' making dialog related to the main form
or
2. FormName.showDialog()
Best Regards
Rizwan Bashir
|
|
|
|
|
That's because .ShowDialog() shows the form as a modal dialog window. Modal means that your application cannot transfer the focus to any other window in the application (including your help window) until that modal window is closed.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hmmmm.... Thanks for the support. I had the same opinion but was looking for another one..
Rizwan Bashir
|
|
|
|
|
how do i save pictures to Access database using VB6 .i used picturebox and "insert into" sql ,it saved in Access,but how i retrieve it back, pl help me
peace love unity respect
|
|
|
|