|
The openFileDialog object may be a better fit for your application.
Again, sorry I misunderstood your question. I have updated my earlier response to reflect this.
...Steve
"Give a man a fish and you've fed him for a day. Teach him how to fish and you've fed him for life." (Translation: I'll show you the way, but not write the code for you.) I read that somewhere once
|
|
|
|
|
lets say i have 2 winforms A and B
on A i have a button that pops B
like
Private Sub btnPoP_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPoP.Click
Dim aFrmAlertPopUp As New B(SomeUniqueID)
aFrmAlertPopUp.display(messages)
End Sub
it will pop a instance of B, it will pass a number id value to the property SomeUniqueID of B.
lets say i click the button 3 times and pass the values
Dim aFrmAlertPopUp As New B(123)
Dim aFrmAlertPopUp As New B(456)
Dim aFrmAlertPopUp As New B(789)
then I want to terminate only instance '456'
if I call
aFrmAlertPopUp.stop(), it kills the 3
is it possible to use something like getProperty to get 1 of the 3 instances and stop it?
|
|
|
|
|
What you've done here is to create a new instance of form B each time the button is pressed on form A, but you have not stored the reference to that form object anywhere.
In effect you have lost the reference to each form after you exit form A's btnPoP_Click() event handler.
You need to keep the references to all forms created in a 2-dimensional array or even better - a Hashtable. That array or Hashtable needs to be instantiated outside of the Click() event - perhaps in form A's initialization.
Whenever you create a new form B in btnPoP_Click() , store the new form B's reference into the array or Hashtable along with the unique data value to identify it.
...Steve
Quote: Artificial Intelligence is no match for natural stupidity
|
|
|
|
|
Can any one give me a code sample that returns 'miles' between two postcodes using the Mappoint Web Service, i have an account and looked at the samples but i just cant do it...
|
|
|
|
|
Hi there,
I got a class inheriting from dictionarybase and when i try to serialize it into an xml file a get an error,
can anybody give me any advice about it?
is there a quick (and simple, i'm a newbie) workaround for it?
Thanks in advance,
cheers!
Fule2Run
|
|
|
|
|
Good evening.
I am using VB.net / Framework 2.0
Does anybody know whether there is an easy way to get the last node(s) of treeview ?
Or is there a possibility to get the last node(s) moving throug a treenode collection and accessing the last node directly ?
Best regards Theo
|
|
|
|
|
I have the following code in Excel VBA that I'm trying to convert to VB.NET:
Workbooks.OpenText(Filename:= _<br />
"C:\temp.txt", Origin:=437, StartRow:= _<br />
1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _<br />
ConsecutiveDelimiter:=False, TAB:=False, Semicolon:=False, Comma:=True _<br />
, Space:=False, Other:=False, FieldInfo:=Array(Array(1, 2), Array(2, 2), _<br />
Array(3, 2), Array(4, 1)), TrailingMinusNumbers:=True)
I've converted everything except the array portion (arrColumnDataType shown below with ???). I'm having a problem coming up with the proper array in VB.NET to put in this code:
Dim xlApp As New Excel.Application<br />
xlApp = CType(CreateObject("Excel.Application"), Excel.Application)<br />
xlApp.Application.Visible = True<br />
Dim strReportName As String = "C:\temp.txt"<br />
<br />
??? How do I define arrColumnDataType ???<br />
<br />
xlApp.Workbooks.OpenText(strReportName, 437, 1, _<br />
Excel.XlTextParsingType.xlDelimited, _<br />
Excel.XlTextQualifier.xlTextQualifierDoubleQuote, False, False, False, _<br />
True, False, False, False, arrColumnDataType, , , , , True)
I know that the array is defined as (column number, format) where format is:
Excel.XlColumnDataType.xlGeneralFormat = 1
Excel.XlColumnDataType.xlTextFormat = 2
Excel.XlColumnDataType.xlMDYFormat = 3
Excel.XlColumnDataType.xlDMYFormat = 4
Excel.XlColumnDataType.xlYMDFormat = 5
Excel.XlColumnDataType.xlMYDFormat = 6
Excel.XlColumnDataType.xlDYMFormat = 7
Excel.XlColumnDataType.xlYDMFormat = 8
Excel.XlColumnDataType.xlSkipColumn = 9
I just can't seem to get a proper array setup that the compiler likes. Does anyone have a suggestion? Has anyone coded this type of project with success. I'm using VS 2005, but I just upgraded about two weeks ago. Is there an easier way in 2.0? Thanks
Lost in the vast sea of .NET
|
|
|
|
|
I always like to follow-up even if a posting that I made is unanswered. Sometimes when you're looking for a programming answer on a message board and you find the exact problem you're having, it is disheartening when there was no answer posted.
Here is the solution that I received on another message board:
http://gotdotnet.com/Community/MessageBoard/Thread.aspx?id=363074&Page=1#363383[^]
Hope someone benefits from the answer in the future.
Lost in the vast sea of .NET
|
|
|
|
|
Help me, please!!!!!!!!!!
|
|
|
|
|
I am having trouble with a trackbar. I am trying to get it to go from 1 at the top(verticaly) to 10 at the bottom. I know I could achive this through much code, but is there a simpler way?
|
|
|
|
|
I am facing the following problem while reading from a file.
FileOpen(filenum, myfilename, OpenMode.Input)
Data = LineInput(filenum).
The Exception is raised even though the File is closed.
Exception raised is as mentioned below:
System.IO.IOException: Bad file name or number. at Microsoft.VisualBasic.FileSystem.GetChannelObj(Assembly assem,
Int32 FileNumber) at Microsoft.VisualBasic.FileSystem.GetStream(Assembly assem, Int32 FileNumber, OpenModeTypes mode) at Microsoft.VisualBasic.FileSystem.GetStream(Assembly assem, Int32 FileNumber) at Microsoft.VisualBasic.FileSystem.LineInput(Int32 FileNumber)
It will be of great help to me.
Thanks,
Praveen.
|
|
|
|
|
pravinkgarg wrote: I am facing the following problem while reading from a file.
Read the error message again - it tells you what the problem is...
pravinkgarg wrote: FileOpen(filenum, myfilename, OpenMode.Input)
Hint: Have you assigned correct and valid values to filenum and myfilename ?
Get a free file number by using FreeFile() .
...Steve
"Give a man a fish and you've fed him for a day. Teach him how to fish and you've fed him for life." (Translation: I'll show you the way, but not write the code for you.) I read that somewhere once
|
|
|
|
|
hi steve,
The same code is working without any Bad FileName or number error, provided i have to run the code without placing any breakpoint for that respective line.What may be the reason i am wondering about it.
ya i gave freefile() before fileOpen in my earlier code.
regards,
Praveen.
|
|
|
|
|
Hi, I am Visual Basic beginner needing help desperately.
I am using Microsoft Visual Studio.Net 2003. I have a basic Form with 3 Labels and 1 Button.
I also have a Database with 3 Fields.
I want the Text from Label1, Label2 and Label 3 to be stored in the database when Button 1 is clicked.
Please can someone help me to do this, with sample code, including the database connection.
Thanks
ensuvari
Regards
ensuvari
|
|
|
|
|
What type of database are you trying to connect to? What is the table structure defined as?
|
|
|
|
|
The database is Microsoft Access. It has one Table called Table1. The table has 3 fields - Date, Task, Duration and a Auto Number ID Primary Key Field.
Please let me know if you need more info
Thanks
Regards
ensuvari
|
|
|
|
|
I want to attach the files and folder images with their respective nodes.
Earlier I got the reply in the form of following code.
Private myimagelist as new imagelist
dim icon as Drawing.icon
myimagelist.colordepth = colordepth.depth32bit
myimagelist.imagesize = new size(16,16)
icon = me.icon
myimagelist.image.add(new drawing.icon(icon ,16 ,16))
treeview.imagelist=myimagelist
Now my question is divided in two parts
1. C:\Document and settings
2. C:\a.txt
In the first case I want to combine the image of folder docomentand settings
but how I will extract the docoment and settings folder icon and How it will be possible to write
icon = "C:\Document and settings"
Same is for the second case
-- modified at 9:10 Tuesday 28th February, 2006
|
|
|
|
|
Hi is there a way of JUST turning on VERTICAL gridlines in a DATAGRID control.
|
|
|
|
|
Sorry just to clarify .. What I mean by turn on is set the colour.
Ie change the vertical colour of the gridlines.
|
|
|
|
|
hi there
can anyone please give me a site that downloads the SNA server version 4
thanks alot
|
|
|
|
|
I have a textbox .I want to bind it with the first row and first column of the particular table(sql server).I mean at run time textbox should display the value .Before that i have made the connection .
Dim dataset as new dataset
dim connection as new sqlconnection("workstation id =abc ; Packet size = 4096 ; integeration security = SSSI ; Data Source = . ; Persist Security info = False ; initial catalog = abcd")
dim tablename as string = "Select * from table"
dim adapter as new Sqldataadapter(tablename , connection)
And on form load
adapter.fill(dataset , tablename)
|
|
|
|
|
I want to populate the listview with the no of database files of sql server during the form load programically.
Please help me.
Thanks and Regards
Pankaj Garg
|
|
|
|
|
Hi all,
Please can you help me on this. I want to create a class dynamically which is inherited from StringConverter with help of Reflection.Emit.
Class
---------------------------------
Public Class EngStatusConverter
Inherits StringConverter
Public Overloads Overrides Function GetStandardValuesSupported(ByVal context As ITypeDescriptorContext) As Boolean
Return True
End Function
Public Overloads Overrides Function GetStandardValues(ByVal context As ITypeDescriptorContext) As StandardValuesCollection
Return New StandardValuesCollection(New String() {"RUNNING", "IDLE"})
'Return New StandardValuesCollection(sStdValues)
End Function
Public Overloads Overrides Function GetStandardValuesExclusive(ByVal context As ITypeDescriptorContext) As Boolean
Return True
End Function
End Class
Using Reflection.Emit
----------------------------
Dim oTypeBuilder As TypeBuilder = Nothing
Dim oMethodBuilder As MethodBuilder = Nothing
Dim oILGenerator As ILGenerator = Nothing
Dim oConstructorInfo As ConstructorInfo = Nothing
Dim oParams() As Type
Try
oTypeBuilder = foModuleBuilder.DefineType("EngStatusConverter", TypeAttributes.Class, GetType(StringConverter))
oMethodBuilder = oTypeBuilder.DefineMethod("GetStandardValuesSupported", MethodAttributes.Public, GetType(Boolean), New Type() {GetType(ITypeDescriptorContext)})
oILGenerator = oMethodBuilder.GetILGenerator
oILGenerator.Emit(OpCodes.Ldarg_0, CType(True, Object))
oILGenerator.Emit(OpCodes.Ret)
oMethodBuilder = oTypeBuilder.DefineMethod("GetStandardValues", MethodAttributes.Public, GetType(StandardValuesCollection), New Type() {GetType(ITypeDescriptorContext)})
oILGenerator = oMethodBuilder.GetILGenerator
oParams = New Type() {GetType(String)}
oConstructorInfo = GetType(StandardValuesCollection).GetConstructor(oParams)
oILGenerator.Emit(OpCodes.Ldarg_0, oConstructorInfo)
oILGenerator.Emit(OpCodes.Ret)
oMethodBuilder = oTypeBuilder.DefineMethod("GetStandardValuesExclusive", MethodAttributes.Public, GetType(Boolean), New Type() {GetType(ITypeDescriptorContext)})
oILGenerator = oMethodBuilder.GetILGenerator
oILGenerator.Emit(OpCodes.Ldarg_0, CType(True, Object))
oILGenerator.Emit(OpCodes.Ret)
Return oTypeBuilder.CreateType
Catch ex As Exception
Throw ex
End Try
But this is not working. Can you help me on this.
|
|
|
|
|
hello
again i have a new problem which makes me crazy....how can i invoke other application like word,excel,acrobat and so on....coz in my case,,first i have to locate first the last 3 or 4 character to able for me get the specified file name like for example...in my txtbox this is the value: c:\..\mydocuments\sample.doc,,,after i locate the path then click the button show to be able to pop up the microsoft word or excel...how i'm gonna do that can you please help about this...
thanks
|
|
|
|
|
In solution select ad refercnce and select com
and select Microsoft office ...9.0
ADD this before calss declaration
Imports Office = Microsoft.Office.Core
try to make a class like this
...........
or u can use with out class directly
Public Class WordAppl
Private oWordAppl As Word.ApplicationClass
Public Sub New()
oWordAppl = New Word.ApplicationClass
strOfficeNote = "OFFICE NOTE"
' GetTagsFromDB()
iRpl = 0
iTagFound = 0
End Sub
' Open a file (the file must exists) and activate it
Public Sub Open(ByVal strFileName As String)
'//////////////////////////////////////
'/ Opens specified Document file /
'//////////////////////////////////////
Dim fileName As Object = strFileName
Dim readOnly1 As Object = False
'Dim isVisible As Object = True
Dim missing As Object = System.Reflection.Missing.Value
'isVisible
'oDoc = oWordAppl.Documents.Open(fileName, missing, readOnly1, missing, missing, missing, missing, missing, missing, missing, missing, isVisible)
oDoc = oWordAppl.Documents.Open(fileName, missing, readOnly1, missing, missing, missing, missing, missing, missing, missing, missing, True)
oDoc.Activate()
End Sub
Public Sub Open()
Dim missing As Object = System.Reflection.Missing.Value
oDoc = oWordAppl.Documents.Add(missing, missing, missing, missing)
oDoc.Activate()
End Sub
Public Sub Quit()
Dim missing As Object = System.Reflection.Missing.Value
oWordAppl.Application.Quit(missing, missing, missing)
End Sub
Public Sub Save()
oDoc.Save()
End Sub
Public Sub SaveAs(ByVal strFileName As String)
Dim missing As Object = System.Reflection.Missing.Value
Dim fileName As Object = strFileName
oDoc.SaveAs(fileName, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing)
End Sub
End Class
Just try it
GOOD LUCK
|
|
|
|
|