Home | Index | Dotnet4all Snippets | Submit resources
About | Mail us 

 
wildcard (Thursday, December 23, 2004)

Found the following interesting discussion in the Newsgroups:

wildcard
by:Anonymous

vb windows .net 2002
crystal reports 9

Record selection formula works fine for currency string result, good for operators =/>= and so on, as follows:
vb form

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim SelectFormula As String
Dim myCrystalReportViewer = CrystalReportViewer1
SelectFormula = "{CLIN_FUND.FUND_AMT} > " & TextBox1().Text
CrystalReportViewer1.SelectionFormula = SelectFormula
......etc

crystal select formula ...
{CLIN_FUND.FUND_AMT} > 500.00;
==========

Now, I'm using a string for a description, and as long as it equals what's in the textbox (= or LIKE), it's fine. But I need to use a wildcard to pull in all results that would contain what the user types in the textbox and it's not working.

vb form

SelectFormula = "{LINE_ITEM.CLIN_DESC} LIKE '" & TextBox1().Text & "'"
CrystalReportViewer1.SelectionFormula = SelectFormula

crystal formula
{LINE_ITEM.CLIN_DESC} LIKE "%%";

I tried inserting a wildcard % in the vb statement, but no luck.

How do I pull in all results that include the user's input in the textbox, please?

Many thanks.

-H



 Reply:
by:Bernie Yaeger

 Hi Helen,

Here's the syntax as it should appear inside crystal:

{prod.bipad} like "187". If the user enters 'an' against a list of names,
this will return nancy, danny, but not bernie and not helen.

HTH,

Bernie Yaeger


 Reply:
by:Anonymous

 Thank you, Bernie. I even got it to work with your scenario, but with a wildcard instead, such as {prod.bipad} like "%%", so it's up and running now and lookin' good. Working for text strings, and multiple fields from multiple tables, but not yet working for string containing numericals. I have a separate posting for this question. Hope to resolve v. soon.
-H



Posted by Xander Zelders
0 Comments



COM wrapper around a .NET assembly

Found the following interesting discussion in the Newsgroups:

COM wrapper around a .NET assembly
by:Graham Blandford

Hi all,

Wonder if anyone can point me in the right direction.

Due to time-constraints, it looks lie I may have to abandon using VB.NET
development in favour of my more familiar VB6 environment. The issue I have
is, that I have to use a .NET assembly (DLL) to access data from a database.

I understand it is possible to create a wrapper using COM which would then
make it available to VB6. Although this isnt ideal, it might help me, in
this partiular case, get to where I need to go a lot quicker. I'm not
familiar with COM, but it may still be less of a learning curve than
..NET....

Any help would be happily received.

Thanks,
Graham



 Reply:
by:JLW

 Do a Google for COM Interop with VB.NET, you can compile your assembly to
act as an ActiveX COM object that VB6 can use without a problem.

HTH
JLW


 Reply:
by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP])

 
<URL:http://msdn.microsoft.com/library/en-us/cpguide/html/cpconexposingnetframeworkcomponentstocom.asp>
<URL:http://msdn.microsoft.com/library/en-us/vbcn7/html/vaconCOMInteroperability.asp>

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>


 Reply:
by:Val Mazur

 Hi Graham,

Check next KBs about it

http://support.microsoft.com/default.aspx?scid=kb;en-us;817248&Product=vb6

http://support.microsoft.com/default.aspx?scid=kb;en-us;317535

--
Val Mazur
Microsoft MVP



Posted by Xander Zelders
0 Comments



More data woes....

Found the following interesting discussion in the Newsgroups:

More data woes....
by:Graham Blandford

Hi all,

Well I abandoned the use of a datagrid in my windows form and have opted to
use a listbox instead.

I have, following a helpful article created an item class and loaded it with
values from an ADO recordset.

Now, if I read the data I get a field (clientid) looking like this;

{FE84ACD5-8263-11D7-B0E7-0080AE000001}

when in fact, the actual data (as viewed using say a binding to a datagrid)
looks like this;

fe84acd5-8263-11d7-b0e7-0080ae000001

Why is it placing {} around the string and CASING up?
AAARRRRGGGHHHH!!

Here's some code snippets - where could this be happening?

By the way - I'm forced to use ADO as the dataaccess method in this case -
it is pulled from a 3rd-party reference which returns an ADO recordset.
I guess I could load the data into a dataset prior to reading - but then I'm
not sure how I read through the set sequentially.....


The defined class:-

Private clientid As String
Private Class ClientListItem
Private clientid As String
Private clientname As String
Public Sub New(ByVal id As String, ByVal name As String)
clientid = id
clientname = name
End Sub
Public Property listclientid() As String
Get
Return clientid
End Get
Set(ByVal Value As String)
clientid = Value
End Set
End Property
Public Property listclientname() As String
Get
Return clientname
End Get
Set(ByVal Value As String)
clientname = Value
End Set
End Property
Public Overrides Function ToString() As String
' this can be whatever you want to show in the listbox
Return clientname & " " & clientid
End Function
End Class
And here's the loading of the data into the listbox;
If rsclients.State <> ADODB.ObjectStateEnum.adStateClosed Then
rsclients.MoveFirst()
While Not rsclients.EOF
id = Trim(rsclients.Fields(0).Value)
name = rsclients.Fields("clientname").Value
' Debug.WriteLine(rsclients.Fields("clientid").Value & " " &
rsclients.Fields("clientname").Value)
' Debug.WriteLine(id.ToString & " " & name.ToString)
Dim liclients As New ClientListItem(id.ToString, name.ToString)
lstClients.Items.Add(liclients)
rsclients.MoveNext()
End While
End If
If anyone has any ideas I'd appreciate it.

Thanks,
Graham


 Reply:
by:Graham Blandford

 Ok.. Ok... yep.. I got it... GUID.....

Thanks, for anyone that already took the time to reply......

Graham


 Reply:
by:CJ Taylor

 Datagrid columns will call the ToString() method of the datatype (which all
have in .NET since they all derive from object). Thats how you get your
display

In your case, your using a GUID which when calling the ToString() removes
the {}'s



Posted by Xander Zelders
0 Comments



Serial Communication

Found the following interesting discussion in the Newsgroups:

Serial Communication
by:André Almeida Maldonado

Hey Guys, I need to send some text to the COM 1 port. How can I do it???????
Thank's


 Reply:
by:Charles Law

 Hi André

If you want VB.NET code you could look here:

http://www.codeworks.it/net/VBNetRs232.htm

It is a very good starting point.

HTH

Charles
André Almeida Maldonado wrote:
> Hey Guys, I need to send some text to the COM 1 port. How can I do
> it???????
>
>
> Thank's


 Reply:
by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP])

 
Thomas Scheidegger's Serial Port FAQ (in German)
<URL:http://groups.google.com/groups?selm=O2UyhTLvDHA.1680%40TK2MSFTNGP12.phx.gbl>

--
Herfried K. Wagner [MVP]



Posted by Xander Zelders
0 Comments



VB and 'graphical' languages

Found the following interesting discussion in the Newsgroups:

VB and 'graphical' languages
by:FE-FR

Hi,

I know that I am in a .net newsgroup, but you probably advise me.

I must use VB6 for a small tool. I need to display an information in a
graphical language (hebrew, arabic, ...).

As a test, I would like to display HELLO on the screen in English and
hebrew. For example, use a LABEL control.

If I select the DAVID font, ... how can I display the caracters I need ?

If I use the 'insert symbol' option in Winword, I can see that graphical
caracters are for example 05D2h (1488). How can I use this with a LABEL
control in VB6 ?

Thanks for your help

FE


 Reply:
by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP])

 
VB6 controls do not support Unicode. If you want to support unicode in
UIs, I would use .NET.

--
Herfried K. Wagner [MVP]



Posted by Xander Zelders
0 Comments



Custom Control Postback Problems

Found the following interesting discussion in the Newsgroups:

Custom Control Postback Problems
by:BluDog

Hi

I have a created a custom web control called ImageBrowser, extract is
below:

<Code>

#Region "Properties"

Public Property Images() As ImageCollection
Get
If ViewState("Images") Is Nothing Then
ViewState("Images") = New ImageCollection
End if
Return CType(ViewState("Images"), GalleryImageCollection)
End Get
Set(ByVal Value As ImageCollection)
ViewState("Images") = Value
End Set
End Property

Public Property CurrentImage() As Integer
Get
Return CInt(ViewState("CurrentImage"))
End Get
Set(ByVal Value As Integer)
ViewState("CurrentImage") = Value
End Set
End Property

#End Region

#Region "Initilization"

Private Sub Page_PreRender(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.PreRender

If Not IsPostBack Then GetData() 'populates Images
collection from database

AddImages()

End Sub

Private Sub AddImages

Dim Image as WebControls.Image
Dim ImageCounter as Integer
For Each Image in Images
Dim ImageButton as New WebControls.ImageButton
ImageButton.ImageUrl = Image.ImageUrl
ImageButton.ID = "Image" & ImageCounter.ToString
Me.Controls.Add(ImageButton)
AddHandler ImageButton.Click, AddressOf Image_Click
ImageCounter += 1
Next

End Sub

#End Region

#Region "Implementation"

Private Sub Image_Click(ByVal sender As Object, ByVal e As
System.Web.UI.ImageClickEventArgs)

Dim ImageName As String = CType(sender, ImageButton).ID
CurrentImage = CInt(ImageName.Substring(5))

End Sub

#End Region

</Code>

Within the AddImages function each image in the Images collection is
added to the control as an ImageButton, I have to do this in the
prerender because i need to know what the CurrentImage property is
from the ViewState and this in the first place i have found it to be
populated.

The only problem is that the event for the ImageButton.Click is not
firing, i believe this is because i have added it to late in the page
life cycle. This appears to be a but of a nasty circle. Does anyone
know where i am going wrong?

Thanks

Blu


 Reply:
by:Raterus

 Eww..

Yeah I think you know your problem already, you need to call AddImages from page_load and not PreRender. By PreRender it is one step too late to process Handlers, as that step just passed.

Here is a good article on the ASP.NET page lifecycle, it may help understanding when viewstate gets populated, I don't see why you couldn't do it in page_load, perhaps you could share your problems when you try that next.

http://www.15seconds.com/Issue/020102.htm

Happy Coding!
--Michael



Posted by Xander Zelders
0 Comments



[Help] my form lost my Tab page1 & page 2.

Found the following interesting discussion in the Newsgroups:

[Help] my form lost my Tab page1 & page 2.
by:Agnes

In design mode, i didn't see my tab page1 & page2, however, in view code, I
see all my textbox object and tab page 1& page2, What's going on ???
I design my form again and again ????
Please help


 Reply:
by:Carl Rapson

 Is the Tab control's Style property set to "None" instead of "Tabs"?

Carl Rapson



 Reply:
by:Agnes

 Tab Control's Style property ??
I can't find such property , where is it ??
Thanks
From agnes


 Reply:
by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP])

 
Is this problem related to the issue you described in another post
(controls not showing up after doing an update of a DLL file)?

--
Herfried K. Wagner [MVP]



Posted by Xander Zelders
0 Comments



[HELP] All textbox and button disappear in design mode

Found the following interesting discussion in the Newsgroups:

[HELP] All textbox and button disappear in design mode
by:Agnes

I got form A which inhertied from frmBASE
Todays, i had re-arrange our usercontrol or other class library. (re-build
them)
suddenly, i found all some forms 's textbox and button disappear in desgin
mode.
As I run them, I still can see the textbox, BUT nothing can be seems in
design mode, How come ???
It is not my first time,
PLEASE HELP!!!
thanks
From Agnes


 Reply:
by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP])

 
Have a look if there is a call to 'Me.Controls.AddRange(...)' in the
form's 'Sub InitializeComponent' that adds all the controls to the form.

--
Herfried K. Wagner [MVP]



Posted by Xander Zelders
0 Comments



Problems with ListAvailableSQLServers (SQLDMO)

Found the following interesting discussion in the Newsgroups:

Problems with ListAvailableSQLServers (SQLDMO)
by:Craig G

i have the following code in a form load event, that (should) simply
populate a combobox with the names of all SQL servers on the network

Dim x As Long
Dim sqlNameList As SQLDMO.NameList

'Filling Servers Name

sqlNameList = sqlApp.ListAvailableSQLServers

For x = 1 To sqlNameList.Count

cbo_Server.Items.Add(UCase(sqlNameList.Item(x)))

Next
Me.Show()

but it falls over on the ListAvailableServers, with the following error

"QueryInterface for interface SQLDMO.NameList failed."

im pretty new to this .net (vb6 previously) so i dont know what is wrong

any idea's??

Cheers,
Craig


 Reply:
by:Patrick Steele [MVP]

 In article <etGzikLREHA.1348@TK2MSFTNGP12.phx.gbl>, Gambit001
@hotmail.com says...
> "QueryInterface for interface SQLDMO.NameList failed."

If you're running SQL2000, make sure SP2 is installed. This was a known
bug fixed in SP2.

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele



Posted by Xander Zelders
0 Comments



debuging web controls

Found the following interesting discussion in the Newsgroups:

debuging web controls
by:Vincent Finn

Hi,

I have some controls (VB.Net) written be someone else
They are loaded using an asp page

How can I debug the contol?
I have tried attaching the process to IExplorer and aspnet_wp.exe but
I get nothing, no breakpoints are hit

I have also tried setting the "Start URL" in the project to the
correct page but it simple displays a message box saying
"Error while trying to run project"

I assume it is something simple but I can't find it in the MSDN or on
the web

Vin


 Reply:
by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP])

 
Do you have the source code of the controls?

--
Herfried K. Wagner [MVP]


 Reply:
by:Vincent Finn

 
I do
I have been trying to attach from the project that builds the controls

I the debugging tab I have it set with a "Start URL" and ASP.Net
debugging enabled
In the build tab I am generating debug information

but when I run it, it tells me that the project isn't configured to be
debugged

Vin




Posted by Xander Zelders
0 Comments



Microsoft.Office.Interop.Excel

Found the following interesting discussion in the Newsgroups:

The type of the Cells property itself returns a Range object (see the object
browser).
"wksExcel.Cells(6, 1)" is actually "wksExcel.Cells.Item(6, 1)", but I don't
know why the type of the Item property is not "Range" although it always
returns a Range object. This might be answered in an Excel VBA group.

--
Armin



Microsoft.Office.Interop.Excel
by:©pEIO

Example:

Dim xlsExcel As Excel.Application
Dim wkbExcel As Excel.Workbook
Dim wksExcel As Excel.Worksheet

xlsExcel = New Excel.Application
wkbExcel = xlsExcel.Workbooks.Open("C:\Test.xls")
wksExcel = wkbExcel.Worksheets(i)

In this point I have an error of conversion because Option Strict On can't
convert
System.Object in Microsoft.Office.Interop.Excel.Worksheet.
It's very strange because before that I install the PIA for Office 2003, the
object
wkbExcel.Worksheets(i) was an Microsoft.Office.Interop.Excel.Worksheet
object.
But I have resolved with this:

wksExcel = CType(wkbExcel.Worksheets(i), Excel.Worksheet)
MessageBox.Show(CType(wksExcel.Cells(6, 1), String))

In the last istruction an exception occurred. The message like this "Cast
not possible
from Range type to String type".
I have try with the MSDN example but the same exception occurred.

Somebody have some idea?? I'm crazy...

Thanks. Ciao.
pEIO


 Reply:
by:Armin Zingler

 
As the message says, a Range object is returned:

dim r as excel.range

r = directcast(wksExcel.Cells(6, 1), excel.range)

msgbox(r.value)
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html



 Reply:
by:©pEIO

 
Very thanks Armin.
But why in the PIA of Excel the wksExcel.Cells(6, 1) are declare Object and
not Excel.Range???

Thanks. Ciao.
pEIO


 Reply:
by:Armin Zingler

 

Posted by Xander Zelders
0 Comments



Double-click event in datagrid?

Found the following interesting discussion in the Newsgroups:

Double-click event in datagrid?
by:Graham Blandford

Hi all,

Can anyone tell me how I can detect the double_click event in a datagrid
CELL. I have a read-only bound grid that appears to only receive the event
if you double_click the header or in between a row...

I'm basically trying to retrieve the value of the underlying row to retrieve
a record selection.

Any help would be appreciated.

Thanks,
Graham


 Reply:
by:Cor Ligthert

 Hi Graham,

You can try to use a textbox in the datagrid and than use the event from
that.

I made once a sample with a tooltip in the datagrid column so maybe you can
change that yourself and try if it works.

I hope this helps?

Cor

\\Private WithEvents dtbCol1 As DataGridTextBox
Private ToolTip1 As New ToolTip
')
Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Datagrid1.ReadOnly = True
Dim ts As New DataGridTableStyle
ts.MappingName = ds.Tables(0).TableName
Dim column As New DataGridTextBoxColumn
ts.GridColumnStyles.Add(column)
DataGrid1.TableStyles.Add(ts)
column = DirectCast(ts.GridColumnStyles(0), DataGridTextBoxColumn)
dtbCol1 = DirectCast(column.TextBox, DataGridTextBox)
column.MappingName = ds.Tables(0).Columns(0).ColumnName
column.HeaderText = "Cor"
column.Width = 30
dv = New DataView(ds.Tables(0))
dv.AllowNew = False
DataGrid1.DataSource = dv
End Sub
Private Sub dtbCol1_ToolTip(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles dtbCol1.MouseEnter
ToolTip1.SetToolTip(DirectCast(sender, DataGridTextBox), _
"Row: " & DataGrid1.CurrentRowIndex + 1)
End Sub
///


 Reply:
by:Ken Tucker [MVP]

 Hi,

http://www.syncfusion.com/FAQ/WinForms/FAQ_c44c.asp#q869q

Ken



Posted by Xander Zelders
0 Comments



Catching "Came from Row" on a RowChange in Datagrid?

Found the following interesting discussion in the Newsgroups:

Catching "Came from Row" on a RowChange in Datagrid?
by:Lars Netzel

I need to capture some sort of a rowchange (or datasource row change) and
what I need in that Event is info from the row I came from not the row I'm
changing to... a tricky for me.. I have no idea of what Object I should be
looking for events for.

Best Regards
/Lars


 Reply:
by:Cor Ligthert

 Hi Lars,

Please stay in the same thread in this way answering becomes impossible.

I have made an answer there.

Cor



Posted by Xander Zelders
0 Comments



Delete Option on a Right Click Menu?

Found the following interesting discussion in the Newsgroups:

Delete Option on a Right Click Menu?
by:Lars Netzel

Hey!

I need to make it possible for a user to delete items from a ListView. I
want it to be as similar to Windows as possible so I want it to happen if I
press Delete or with a RightClick menu with a delete option.

I have no idea on how to fix any of the two.. where do I start?

/Lars


 Reply:
by:Lars Netzel

 Oh, it was simple... sorry for wasting your time!

/Lars



Posted by Xander Zelders
0 Comments



How to open a new browser

Found the following interesting discussion in the Newsgroups:

How to open a new browser
by:Anonymous

Hi,
I used the following code to open a browser:

System.Diagnostics.Process.Start(url)

however, it took the latest activate opened browser (if exists already). I'd like to know how to open such web page in a new browser A, and every time I run the code again, the web page must be opened only in this browser A.

Thanks in advance


 Reply:
by:William Ryan eMVP

 Try Process.Start("iexplore.exe", url)

--
W.G. Ryan MVP Windows - Embedded

http://forums.devbuzz.com
http://www.knowdotnet.com/dataaccess.html
http://www.msmvps.com/williamryan/


 Reply:
by:Anonymous

 Thanks William,

It works fine. How about the situation for checking if the browser is already openned?




Posted by Xander Zelders
0 Comments



Opening an existing file on my PC

Found the following interesting discussion in the Newsgroups:

Opening an existing file on my PC
by:LB

I have one form that has two buttons. I want the first button to exit the
form, and the second button to open a specific file on my C: drive.

I can get the form to close (Woo!), but can anybody tell me the code needed
to open an existing file on my computer. I've spent all morning looking on
the net but have had no luck.

The file, if it makes any difference, is a .pps

Thanks in advance people.

Luke



 Reply:
by:Cor Ligthert

 Hi Luke,

Can you try this one

\\Dim p As New System.Diagnostics.ProcessStartInfo()
p.FileName = "C:\filename.pps"
p.UseShellExecute = True
System.Diagnostics.Process.Start(p)
///

Cor


 Reply:
by:Hal Rosser

 Try using the System.IO.StreamReader class
dim sr as System.IO.Streamreader
sr = new System.IO.StreamReader("theFileName.pps")

assuming you want to read the file
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.690 / Virus Database: 451 - Release Date: 5/22/2004



Posted by Xander Zelders
0 Comments



Convert charref ({) to normal letters

Found the following interesting discussion in the Newsgroups:

Convert charref ({) to normal letters
by:Daniel Köster

Hi I asked this question a couple of days ago as well but I didn't get any
answers that I could use.

Is there someone who has got som tips on how to convert text encoded with
character referense ({) to unicode or uft-8 format using VB.net? Is
there a
function or something that can help with the conversion?

To use a simple replace "this" with "that" is not an option since there are
som asian-texts that I need to convert as well. (chinese, thai and japanese;
the replace list would be to large to handle)

What i want to do is to be able to compare a file coded with character
references (i.e. {) with a file coded with normal unicode characters
(i.e. ö,ä,å)

Best regards
Daniel


 Reply:
by:Cor Ligthert

 Hi Daniel,

These questions like yours in the dotnet newsgroups are mostly answered by
Jay B. Harlow, however even more by Jon Skeet, however Jon is definitly not
VB.net.

So I think you have more change, when you ask this question as well in the
newsgroup

Microsoft.public.dotnet.general as well.

There is Jon often active.

Cor


 Reply:
by:Daniel Köster

 OK! I'll try there as well.
Thank you Cor!



Posted by Xander Zelders
0 Comments



Convert charref ({) to normal letters

Found the following interesting discussion in the Newsgroups:

Convert charref ({) to normal letters
by:Daniel Köster

Hi I asked this question a couple of days ago as well but I didn't get any
answers that I could use.

Is there someone who has got som tips on how to convert text encoded with
character referense ({) to unicode or uft-8 format using VB.net? Is
there a
function or something that can help with the conversion?

To use a simple replace "this" with "that" is not an option since there are
som asian-texts that I need to convert as well. (chinese, thai and japanese;
the replace list would be to large to handle)

What i want to do is to be able to compare a file coded with character
references (i.e. {) with a file coded with normal unicode characters
(i.e. ö,ä,å)

Best regards
Daniel


 Reply:
by:Cor Ligthert

 Hi Daniel,

These questions like yours in the dotnet newsgroups are mostly answered by
Jay B. Harlow, however even more by Jon Skeet, however Jon is definitly not
VB.net.

So I think you have more change, when you ask this question as well in the
newsgroup

Microsoft.public.dotnet.general as well.

There is Jon often active.

Cor


 Reply:
by:Daniel Köster

 OK! I'll try there as well.
Thank you Cor!



Posted by Xander Zelders
0 Comments



Using projects

Found the following interesting discussion in the Newsgroups:

using projects
by:Anonymous

Hey Everyone
Ok so i've finished a project and now I want to give it to someone else without vb.net, (i want to give it to them as an exe file)
How do get the .vb net files to turn into .exe files so I can give it to other people?
Thanks everyone.


 Reply:
by:Lars Netzel

 When you Bulid your Project (or solution) they are compiled into an EXE (or
dll or other depending on what settings and projecttype you have)

The EXE file by default is place in the BIN folder directly under the root
of the projectfolder!

/Lars


 Reply:
by:Cor Ligthert

 Hi Tom,

You can make an msi file using a deployment project,

This link is not the best walkthrough in my opinion however a good start

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsintro7/html/vbtskCreatingInstallerForYourApplication.asp

I hope this helps?

Cor


 Reply:
by:Anonymous

 Thanx everyone!



Posted by Xander Zelders
0 Comments



Help with Datagrid events please.

Found the following interesting discussion in the Newsgroups:

Help with Datagrid events please.
by:Lars Netzel

I have a datagrid, datasource is a dataset that contains no items... I place
the cursor in the first cell in the datagrid and start typing values.. after
I have filled in all the "mandatory" fields a new row is created in the
bottom of the grid (with a * character as the rowheader).... I need to
capture that Event when that happens so I can do other stuff depending on
the info I just entered on the first row, but I need to know that that row
is okay first.

I tried Datasource Changed but that did'nt give anything!

Besr regards/
Lars Netzel


 Reply:
by:Ken Tucker [MVP]

 Hi,

Maybe this will help.
http://www.syncfusion.com/FAQ/WinForms/FAQ_c44c.asp#q823q

Ken


 Reply:
by:Lars Netzel

 Thankx but no, not really, it did'nt help me.

I need to capture a RowChange (or datasource row change) and what I need in
that Event is info from the row I came from!

/Lars


 Reply:
by:Cor Ligthert

 Hi Lars,

When that * appears the data is written in the dataset or better in the
datatable.

Did you already look if the datatable events can do something for you.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemDataDataTableEventsTopic.asp

If you want it before that you will need the datagrid currentcell changes a
problem however I thought that did not fire when you acknowledge the row and
the * appears.

This is a known problem you often see in this newsgroup, when you go
searching for it watch especially for messages/answers from CJ Taylor who
often talks about this problem as well, there seems even to be even a
difference with this between dotnet 1.0 and dotnet 1.1

I hope this helps anyhow?

Cor



Posted by Xander Zelders
0 Comments



Quotes within a text string

Found the following interesting discussion in the Newsgroups:

Quotes within a text string
by:Anonymous



ADVERTISEMENT


Is there any way to display quotes Themselves - within a text string

textbox1.text = "This is a "test" of inserting quotes".

I want to actually use quotes within this string around the word
test - but the program picks this up as me ending the string and then
obviously does not like the work test just sitting there and then it
tries ot start up the string again.

Is there a way to insert a special ascii character?

thanks.



 Reply:
by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP])

 
\\TextBox1.Text = "This is a ""test"" of inserting quotes"
///

--
Herfried K. Wagner [MVP]



Posted by Xander Zelders
0 Comments



Quotes within a text string

Found the following interesting discussion in the Newsgroups:

Quotes within a text string
by:Anonymous



ADVERTISEMENT


Is there any way to display quotes Themselves - within a text string

textbox1.text = "This is a "test" of inserting quotes".

I want to actually use quotes within this string around the word
test - but the program picks this up as me ending the string and then
obviously does not like the work test just sitting there and then it
tries ot start up the string again.

Is there a way to insert a special ascii character?

thanks.



 Reply:
by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP])

 
\\TextBox1.Text = "This is a ""test"" of inserting quotes"
///

--
Herfried K. Wagner [MVP]



Posted by Xander Zelders
0 Comments



Set the default "initial" value of a ComboBox

Found the following interesting discussion in the Newsgroups:

Set the default "initial" value of a ComboBox
by:Anonymous

I have populated (or created a collection) in a ComboBox. However - I would like to set a default value - when my form is first opened (for the ComboBox) - like "Select topic".

However - when I attempt to add this text to the Text property of the Combobox - it does not take. In other words, I type it in the property - but when I leave the field - it is blank. I also tried modifying the ComboBox control - in the following manner:

'ComboBox1
'
Me.ComboBox1.Items.Add("1")
Me.ComboBox1.Items.Add("2")
Me.ComboBox1.Items.Add("3")
Me.ComboBox1.Items.Add("4")
Me.ComboBox1.Location = New System.Drawing.Point(56, 38)
Me.ComboBox1.Size = New System.Drawing.Size(176, 22)
Me.ComboBox1.Text = "Select Topic"

I added the last line "Me.ComboBox1.Text = "Select Topic" - but again - it would not apply the value - when I sent to the emulator.

Why is that?


 Reply:
by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP])

 * "=?Utf-8?B?S2VpdGg=?=" <anonymous@discussions.microsoft.com> scripsit:
> I have populated (or created a collection) in a ComboBox. However - I would like to set a default value - when my form is first opened (for the ComboBox) - like "Select topic".

Set the control's 'SelectedIndex' property.

--
Herfried K. Wagner [MVP]


 Reply:
by:George Yefchak

 You want "SelectedItem," not "Text."

--George



Posted by Xander Zelders
1 Comments



Re: Restrict keys in textbox w/o KeyAscii?

Found the following interesting discussion in the Newsgroups:

Re: Restrict keys in textbox w/o KeyAscii?
by:hansolo

> Ok folks. Had some code in VB6 that worked fine within a TextBox KeyPress



 Reply:
by:Claes Bergefall

 Can't seem to find the start of this thread?!
Well, ayway

There is nothing wrong with your keyboard
You have your ASCII codes mixed up
n = 110
N = 78
Backspace = 8
/ = 47

ASCII for Del is irrelevant since it doesn't generate a KeyPress event
Never heard of the HELP key. Do you mean F1?
You should support ',' aswell (ASCII 44)

/claes


 Reply:
by:hansolo

 Thanks, you are correct as I am sure you know. I was getting my information
from the Keys Enumeration member help topic in .NET 2003. Evedently a few
things in this table do not match the Ascii codes. Pretty close though.

Thanks for picking up on my error.

Chuck



Posted by Xander Zelders
0 Comments



Returning values FROM window form

Found the following interesting discussion in the Newsgroups:

returning values FROM window form
by:Graham Blandford

Hi all,

Quickie - I hope. I already know how to use a forms New() Sub to receive
parameters from a calling class - but I don;t know how to return values...

Anyone know the recommended method for doing this?

Thanks,
Graham


 Reply:
by:William Ryan eMVP

 Create some properties corresponding to each of those values, or create a
class that holds all of them and make a property of that class in your
target form.

Before that form closes, set them all...

this.FirstValueYouWantReturned = Whatever;
or me.FirstValueYouWantReturned = Whatever (vb.net)
and repeat this for each varaible. Assume these properties were added to
Form2.

So...

Form2 frm = new Form2(SomeValue, SomeOtherValue);//this means you passed in
two variables
frm.Show();

or Dim frm as Form2 = new Form2(SomeValue, SomeOtherValue)
frm.Show()

now, in form2 set those properties as I showed you above to the values you
want returned

string FirstValue = frm.FirstValueYouWantReturned;
string SecondValue = frm.SecondValueYouWantReturned;

same process for VB.NET at this point.

Or you coudl just create one property of type someClass that contains all of
the variables. Then you set them in the class (remember, it's still a
property of Form2 which is essential to either approach, this just
consolidates it).

then

string FirstValue = frm.SomeObject.FirstValueYouSet;
string SecondValue = frm.SomeObject.SecondValueYouSet;

HTH,

Bill

--
W.G. Ryan MVP Windows - Embedded

http://forums.devbuzz.com
http://www.knowdotnet.com/dataaccess.html
http://www.msmvps.com/williamryan/


 Reply:
by:Graham Blandford

 Thanks Bill.

I'll give it a try.


 Reply:
by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP])

 
Add properties to the form and set the property values inside the form.

--
Herfried K. Wagner [MVP]



Posted by Xander Zelders
0 Comments



Make multithreading do only X threads at a time.

Found the following interesting discussion in the Newsgroups:

Make multithreading do only X threads at a time.
by:Manuel

I have a long function that needs to be done 1000 times. I'm
multithreading it, but I don't want to load them up all at once, instead
load them 10 at a time.

So far the only way I can get it to work is by creating a dummy form
with a timer. On the timer function I test if the number of threads are
less than 10 then run the remaining ones. This is working fine, but I
would like to know how to do it without the form.

This is the code I'm trying to use to accomplish the feat without the form:

Module mdlAny()
Public Sub Main()
Do
FunctionThatCalls10Threads()

PauseThisThing() 'Replace this with
'either of the bottom functions
Loop
End Sub

Private Sub PauseThisThingThatWorks()
'It works with this code:
'On the Timer event, I call
'the FunctionThatChecksTheNumberOfThreads()
'to see if I can close the form.
'(and hence continue with the program)

Dim wf As WaitForm = New WaitForm
wf.ShowDialog()
End Sub

Private Sub PauseThisThingThatDOESNOTWork()
'It doesn't work with this code for waiting

Dim RetValue as Boolean
Do
System.Threading.Thread.CurrentThread.Sleep(1000)
RetValue = FunctionThatChecksTheNumberOfThreads()
Loop Until RetValue
End Sub
End Module

.................................................................
Posted via TITANnews - Uncensored Newsgroups Access
>>>> at http://www.TitanNews.com <<<<
-=Every Newsgroup - Anonymous, UNCENSORED, BROADBAND Downloads=-



 Reply:
by:Tom Shelton

 

' Dummy code, in a fictious Console application
Option Strict On
Option Explicit On

Imports System
Imports System.Threading

Module modMain
Private Const MAX_THREADS As Integer = 9
Private threads(MAX_THREADS) As Thread

' just so we can get the system thread handle :)
Private Declare Function GetCurrentThreadId Lib "kernel32" () As IntPtr

Public Sub Main()
Dim rnd As New Random

For i As Integer = 0 To MAX_THREADS
threads(i) = New Thread(AddressOf Run)

' randomize the wait...
Thread.Sleep(rnd.Next(100, 1000))

threads(i).Start()
Next

Console.ReadLine()

For i As Integer = 0 To MAX_THREADS
threads(i).Abort()
Next

Console.ReadLine()
End Sub

Private Sub Run()
Dim i As Integer = 0
Dim id As Integer = GetCurrentThreadId().ToInt32()

Try
Do
i += 1
Console.WriteLine("ThreadId {0}: i={1}", _
id, i)
Thread.Sleep(1000)
Loop
Catch ex As ThreadAbortException
Console.WriteLine("ThreadID {0} Aborted!", id)
End Try
End Sub
End Module

I'm not sure if this is what you wanted... But maybe it will help you :)
--
Tom Shelton [MVP]


 Reply:
by:Manuel

 Tom Shelton wrote:

>
> I'm not sure if this is what you wanted... But maybe it will help you :)

Not quite. What you are doing is starting the threads every X amount of
time, where X is a random number.

I want to be able to run 10 threads and then wait until less than 10 are
finished and load 10 more, rinse and repeat...

Thanks

.................................................................
Posted via TITANnews - Uncensored Newsgroups Access
>>>> at http://www.TitanNews.com <<<<
-=Every Newsgroup - Anonymous, UNCENSORED, BROADBAND Downloads=-



 Reply:
by:Jay B. Harlow [MVP - Outlook]

 Manuel,
In addition to my other comments.

The reason I suggested a thread pool (either the built in one, or roll your
own).

Is that starting & stopping 1000 threads, 10 at a time is expensive. It's
generally better to start 10 threads and let each thread process 100
requests. A Thread pool normally has a single queue of requests when a
thread is done working on a request it simply gets the next request in order
& processes it...

Using the ISynchronizeInvoke interface you could setup the ThreadPool so
that it was able to raise an event on your main Thread (your UI thread) to
notify it when all the requests were done... (The thread pool object would
have an ISynchronizeInvoke variable, when the last request finished it would
use ISynchronizeInvoke.Invoke to invoke a delegate, that raised an event.
The ISynchronizeInvoke variable would hold an instance of your form, causing
ISynchronizeInvoke.Invoke to run on the UI thread. Using ISynchronizeInvoke
to raise the event would mean the main form would not need to poll to see if
all the requests were done or not...

Hope this helps
Jay


 Reply:
by:Jay B. Harlow [MVP - Outlook]

 Manuel,
It sounds like you simply want to use the System.Threading.ThreadPool or
roll your own Thread Pool.

System.Threading.ThreadPool allows by default 25 threads per processor. To
use it you would simply use ThreadPool.QueueUserWorkItem 1000 times with the
same function address... See System.Threading.ThreadPool for details...

Alternatively if you want to limit it to 10 threads, you will need to write
your own Thread Pool. I would create a new Thread Pool class that started 10
Threads. My Thread Pool class would have a System.Collections.Queue object
that represented the requests. Each thread would dequeue an item and work on
it. I would have a special request or other mechanism available to tell each
thread that it is time to exit. I would also include a single
AutoResetEvent, that each thread would wait on to see if an item is in the
Queue. Plus there should be a padlock object (I normally use "New Object")
that you can SyncLock on to ensure that reading & writing to the queue is
properly synchronized.

Writing your own thread pool will not be as easy as I am making it sound,
however it is fairly easy! The above should be enough to get you started,
alternatively you could search google for a sample. Tom's code may help you
get started...

Note I've done the above & posted to the newsgroup my alternative above
using a single thread.

Hope this helps
Jay



Posted by Xander Zelders
0 Comments



Is it possible to execute an iSeries program from a VB.Net application?

Found the following interesting discussion in the Newsgroups:

Is it possible to execute an iSeries program from a VB.Net application?
by:Ken Sturgeon

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1400" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV>
<P><FONT face=Arial size=2>Is it possible to execute an iSeries program from a
VB.Net application? Where might I find some reference material that would get me
started?</FONT></P></DIV></BODY></HTML>



 Reply:
by:AlexS

 Hi, Ken

yes, it is possible.

How - depends on what you have to connect to iSeries. I would suggest to go
to IBM site and start from products you have available. In simplest form it
is possible through FTP connection. Check which commands are available on
host and go from there.

HTH
Alex

"Ken Sturgeon" <aksturgeon@charter.net> wrote in message
news:10bd0pddrfu8v22@corp.supernews.com...
Is it possible to execute an iSeries program from a VB.Net application?
Where might I find some reference material that would get me started?


 Reply:
by:Tim Shelton

 
Do it just like you would a s stored proc in SQL. The only difference
instead of putting the program name for the SP you have to use the call
command (i.e. call <program name>).

Take a look at IBM's access product. It used to be called Client Access.

Hope this helps.

Tim



Posted by Xander Zelders
0 Comments



Datagrid columns

Found the following interesting discussion in the Newsgroups:

datagrid columns
by:Lisa

Still trying to get rich text from my dataset into a datagrid. So far, my
strategy has been to derive a custom column style which owns a rich text
box:

Public Class RTColumn
Inherits DataGridColumnStyle

Dim WithEvents rtb As RichTextBox = New RichTextBox()
Dim PHeight As Integer = 0
Dim PSize As Size
Dim MHeight As Integer = 0
Dim ioMemoryStream As MemoryStream
Dim rtbg As Graphics
Dim mfMetaFile As Metafile
Dim ptrHDC As IntPtr

I want the rich text box with events, because I'd like to know the size of
the contents when the text is assigned to rtb:

Private Sub rtb_ContentsResized(ByVal sender As Object, ByVal e As
System.Windows.Forms.ContentsResizedEventArgs) Handles rtb.ContentsResized
If e.NewRectangle.Height > MHeight Then
MHeight = e.NewRectangle.Height
End If
If e.NewRectangle.Height > PHeight Then
PHeight = e.NewRectangle.Height
End If
PSize = e.NewRectangle.Size
End Sub

To draw the contents of the rtb, I create a metafile in the Paint override:
Protected Overloads Overrides Sub Paint(ByVal g As System.Drawing.Graphics,
ByVal bounds As System.Drawing.Rectangle, ByVal [source] As
System.Windows.Forms.CurrencyManager, ByVal rowNum As Integer, ByVal
backBrush As System.Drawing.Brush, ByVal foreBrush As System.Drawing.Brush,
ByVal alignToRight As Boolean)
Try
Dim rt As String = Me.GetColumnValueAtRow([source], rowNum)
g.FillRectangle(backBrush, bounds) 'this has the effect
of erasing the cell
If rt <> "" Then
rtb.Rtf = rt
ioMemoryStream = New MemoryStream()
' Get a graphics context from the RichTextBox
Dim rtbg As Graphics = rtb.CreateGraphics
' Get the device context from the graphics context
ptrHDC = rtbg.GetHdc()
' Create a new Enhanced Metafile from the device context
mfMetaFile = New Metafile(ioMemoryStream, ptrHDC)
' Release the device context
rtbg.ReleaseHdc(ptrHDC)
' Draw the metafile
g.DrawImage(mfMetaFile, bounds.X, bounds.Y, PSize.Width,
PSize.Height)

End If
Catch
MsgBox(Err.Description)
End Try
End Sub 'Paint

Not only does this fail to draw the rich text in the datagrid cell, but I
get a 'Cast from type 'DBNull' to type 'String' is not valid' error after
scrolling the grid to the last row.

I know about the dotnet.leadit.be/extendeddatagrid. It looks intruiging,
but I'd really rather understand what I'm doing, and not have to include
another dll with my project. If anyone can point out the error of my ways,
I'd very much appreciate it.




 Reply:
by:Ken Tucker [MVP]

 Lisa,

To avoid the cast from dbnull to string error use
getcolumnvalueatrow.tostring

Dim rt As String = Me.GetColumnValueAtRow([source], rowNum).tostring

Here is a link on how print a rich text box contents. Maybe the
graphics code will help.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwinforms/html/wnf_RichTextBox.asp

Ken


 Reply:
by:Lisa

 Ken,
Thanks - the .tostring was a dumb error on my part. And thanks for the
reference: I'll look at it tonight.



Posted by Xander Zelders
0 Comments



XML?, INI File?, How do I do this?

Found the following interesting discussion in the Newsgroups:

XML?, INI File?, How do I do this?
by:Anonymous

I am writing an app that has a gui with many labels on it. It is launched from within another app with a hotkey. It runs full screen and has an image for a background. The is no border or menu whatsoever. I want the user to be able to change font sizes, label locations, background image and a few other parameters and have the changes reflected when the application is launched. What is the best way to accomplish this?

Thank you,
John


 Reply:
by:Ken Tucker [MVP]

 Hi,

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnadvnet/html/vbnet02122002.asp

Ken



Posted by Xander Zelders
0 Comments



character selection in a string

Found the following interesting discussion in the Newsgroups:

character selection in a string
by:Anonymous

I have the following type of data sitting in a varaible:

Just Buttons+button

The text and lenght can change, however, no matter what the length is I would like to strip off the "+" sign and everything to the right of it and place it into another (or the same) variable. What is the easiest way to accomplish this?

Thank you,
John


 Reply:
by:Armin Zingler

 
Dim s As String

s = "Just Buttons+button"

s = s.Split("+"c)(0)
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html


 Reply:
by:Jay B. Harlow [MVP - Outlook]

 John,
In addition to Armin's suggestion:

Dim s As String

s = "Just Buttons+button"

s = s.SubString(0, s.IndexOf("+"c)

I suspect there are probably 2 or 3 other methods you could use ;-)

Hope this helps
Jay


 Reply:
by:Cor Ligthert

 HI Jay,

> I suspect there are probably 2 or 3 other methods you could use ;-)

It was for me a challenge and I can give of course a VB left function,
however the one you gave is the best in my opinion and therefore I will not
bring the OP in problems by giving him another one.

:-)

No need answering.

Cor



Posted by Xander Zelders
0 Comments



Split function not working.....

Found the following interesting discussion in the Newsgroups:

Split function not working.....
by:Jay

So I'm writting this software that talks to an IRC server; and occasionaly
IRC servers send back data two lines at a time with lines breaks inside.
For my own sanity I had been using the split funciton to break these lines
down to seperate ones and then process the server commands etc. However
lately the split funciton seems incapable of finding chr(10)+chr(13) and
wont split the lines. When I dump the data to a text file however and open
it in notepad, notepad recognizes the lines and seperates them.

What is going on and how can I fix it?


 Reply:
by:Sven Groot

 
A newline in Windows is chr(13) & chr(10) not the other way around.

Use the ControlChars.CrLf or ControlChars.NewLine constants.

--
Sven Groot

http://unforgiven.bloghorn.com


 Reply:
by:Jay

 Oh Thank You, I thought I was going to loose my mind today :-)
| A newline in Windows is chr(13) & chr(10) not the other way around.
|
| Use the ControlChars.CrLf or ControlChars.NewLine constants.
|
| --
| Sven Groot
|
| http://unforgiven.bloghorn.com



Posted by Xander Zelders
0 Comments



Multi-Lingual application

Found the following interesting discussion in the Newsgroups:

Multi-Lingual application
by:Z D

Hello,

I need to support multiple languages in a product package being developed in
both ASP.NET (vb.net) and WinForm .net (c#).

I was wondering if there are any best practice guides, application blocks,
resources, tutorials, or just general advice that someone could recommend to
get me started.

What is the best way to approach a multi-lingual asp.net application? Same
for a WinForms.Net app.

Thank-you very much

-ZD




 Reply:
by:Patrick Steele [MVP]

 
See: http://tinyurl.com/2bbcf
--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele


 Reply:
by:Cor Ligthert

 I am suprissed that I have never seen answers on this kind of questions from
by instance
EricJ, Dominique, Pieter and other Belgians or Swiss,

For who not know, it are two relative small countries where standard is
spoken:
Belgie: Dutch, French and for a small part German
Swiss: German, French, Italian and a kind of Latin language I thought,

And I am intrested how they deal with this.

Cor



Posted by Xander Zelders
0 Comments



HasChanges not being updated?

Found the following interesting discussion in the Newsgroups:

HasChanges not being updated?
by:Graham Blandford

Hi all,

I'm sure I must be missing something here.. I've created a simple parent -
child form appl. in which I open a dataset in the parent (MDI) using a
dataadaptor to an Access database, and a dataset.

The SELECT of the record set searches for a specific entry, if it returns a
0 rowcount, I go throiugh the motions of adding a row, and opening the child
form.. if it is found I just open the child form..

I am passing the dataset through the constuctor to my child form, and if I
use a datagrid to change the data, it marks the HasChanges correctly.
But, as i am only dealing with one row here, and I would like to use text
boxes for each column, I have tried to bind these in code - taken from the
..NET library...DataBindings entry...

The problem is, if I change the data in a text box, (incidentally, if I
leave the datagrid on the form, the cell appears to update for the changed
text), the HasChanges flag is not being set to True. Is there something I
need to code that will cause this to happen?

Here's a snippet of the code...

Parent form:

With daLinkMAN_client_trans

.SelectCommand.Parameters("nman_path").Value = str_nman_path

.Fill(dsLinkMAN)

End With

' if empty then add

If dsLinkMAN.Tables("client_trans").Rows.Count = 0 Then

Dim dr_client_trans As DataRow

dr_client_trans = dsLinkMAN.Tables("client_trans").NewRow

With dr_client_trans

.Item("nman_path") = str_nman_path

.Item("description") = "New database"

.Item("summit_client_id") = ""

dsLinkMAN.Tables("client_trans").Rows.Add(dr_client_trans)

End With

End If

' open client form

Dim frm As New frmClient(daLinkMAN_client_trans, dsLinkMAN, cnLinkMAN)

' frm.MdiParent = Me

frm.ShowDialog()

Debug.WriteLine(dsLinkMAN.HasChanges)

Debug.WriteLine(dsLinkMAN.HasErrors)

daLinkMAN_client_trans.Update(dsLinkMAN.Tables("client_trans"))

dsLinkMAN.Tables("client_trans").Clear()

In the Child form I have...

txtpath.DataBindings.Add(New Binding("Text", ds_client_trans,
"client_trans.nman_path"))

txtdescription.DataBindings.Add(New Binding("Text", ds_client_trans,
"client_trans.description"))

txtclient.DataBindings.Add(New Binding("Text", ds_client_trans,
"client_trans.summit_client_id"))

DataGrid1.DataSource = ds_client_trans.Tables("client_trans")
If anyone could shed any light on this I'd be most grateful.

Thanks,
Graham


 Reply:
by:Cor Ligthert

 




Posted by Xander Zelders
0 Comments



VB6 conversion of UDT to structure - ValueType?

Found the following interesting discussion in the Newsgroups:

VB6 conversion of UDT to structure - ValueType?
by:Chuck Ritzke

Okay, just when I thought I was starting to understand stuff. In VB6...

Type MyDataType
Dim Value1 as double
Dim Value2 as double
End Type

Dim MyData1 as MyDataType
Dim MyData2 as MyDataType

MyData1=MyData2

'...Do stuff to MyData2, MyData1

When I did this in VB6, MyData1 and MyData2 were separate values (ie if I
changed values on one subsequently, the other remained unchanged). When the
code is converted to VB.NET, it changes Type to Structure. I read
documentation and it says structures are ValueTypes and not ReferenceTypes
like classes. So I expected the same behavior as in VB6. But in my converted
code, it appears that MyData1 is just a reference to MyData2 because
subsequent changes to one, change the other. What gives? And what is the
easiest way to create a cloned MyData1 instead of just a reference to
MyData2? I hope I don't have to go thru my VB6 code and set each value
inside the structure.

TIA,
Chuck



 Reply:
by:Patrick Steele [MVP]

 
There must be something else wrong in your code. I was unable to
produce such behavior using this code:

Option Strict On
Option Explicit On

Structure MyDataType
Dim val1 As Double
Dim val2 As Double
End Structure

Module Module1

Sub Main()
Dim d1 As MyDataType
Dim d2 As MyDataType

d1.val1 = 11
d1.val2 = 22

d2 = d1

d1.val1 = 999
d1.val2 = 888
End Sub

End Module

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele


 Reply:
by:Chuck Ritzke

 Thanks Patrick,

I looked further and realized that my problem happens because the value
inside the structure are arrays. Arrays inside the structure become
references to each other whereas primitive variables stay independent. It
sure would help to have a quick fix to handle this difference between VB6
and .NET.

So modifying your example...

Structure MyDataType
Dim val1() As Double
Dim val2 As Double
End Structure

Module Module1

Sub Main()
Dim d1 As MyDataType
Dim d2 As MyDataType
reDim d1.val1(1)
reDim d2.val1(1)

d1.val1(1) = 11
d2.val1(1) = 22
d1.val2=44
d2.val2=55
'AT THIS POINT BOTH ARRAYS AND VARIABLES INSIDE d1 and d2 ARE
INDEPENDENT

d2=d1

d2.val1(1) = 999
d2.val2=888
'NOW THE RESULT IS
'd1.val(1)=999 and d2.val(1)=999 and now reference each other
whereas...
'd1.val2=55 and d2.val2=88 are still independent

End Sub

End Module


 Reply:
by:Chuck Ritzke

 It looks like I can write a "cloning" function for each UDT to handle
arrays...

Function CloneMyDataType(MyData as MyDataType)

Dim MyCopy as MyDataType

MyCopy=MyData
MyCopy.Val1=VB6.CopyArray(MyData.Val1)
'and repeat last line for each array in MyDataType

Return MyCopy

End Function

'Then instead of d2=d1

d2=CloneMyDataType(d1)
But do you have a quicker/better way? I have lots of UDT's each with lots of
arrays inside.

TIA,
Chuck


 Reply:
by:Patrick Steele [MVP]

 
In .NET you could implement the ICloneable interface and get basically
the same results.

But, in the end, you will have to copy the arrays manually when copying
the structs (types). This is known as a "deep copy". By default, you
get a "shallow copy" where only the reference to the array is copied --
thus making both structs point to a single array.

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele



Posted by Xander Zelders
0 Comments



Deployment question

Found the following interesting discussion in the Newsgroups:

Deployment question
by:Woody Splawn

I have a non-web VB.net applicaiton that I have written. I have written it
on a client machine of a local area network. The solution is on the local
hard drive of this client machine with the back-end database (SQL Server) on
the file server of the network. How do I now make this applicaiton
available to other machines on the local area network? There are about 10
other machines all running XP with the dotnet framework installed.



 Reply:
by:Anonymous

 Hi,

I do not know if this is the best way to do this, but with you made a MSI installer there are some ways that everytime you update your software on a main machine is automatically installs in all the others computers. Please note that with this you will have to adapt you code to acess the SQL Database in just one machine, ifg not, each machine will have one Database.

I do know if it works also, but try to share your application, it is completely wrong, maybe it could give errors when the users are acessin the database at the same time, it could cause a system slow down problem, however, I do know not if it could work, the first way is more appropriated.
I hope that helps.

ltt


 Reply:
by:Woody Splawn

 I'm sorry but I find it difficult to understand the response because of
language issues.

What I would like to avoid is running an .MSI from each machine.

Thanks for the try.

Wood


 Reply:
by:Cor Ligthert

 Hi Woody,

In addition to ITT, the method to create an install directory on a server,
is for me a very good way to go, keep in mind that you do not delete that
directory or the msi.

It is is needed again when you deinstall.

Just a little thing.

Cor


 Reply:
by:Brad Allison

 Woody,

We keep our installation files on a specified directory on a small computer
that also acts as a file server for our workgroup. Those who have access to
this directory can then install the program as needed.

Brad



Posted by Xander Zelders
0 Comments



Can a VB.NET 2003 project work with framework 1.0?

Found the following interesting discussion in the Newsgroups:

Can a VB.NET 2003 project work with framework 1.0?
by:Anonymous

Hi all,

I've a project that has been developed with VS .NEt 2003 (which works with framework 1.1). Is there a way to Build this project in order to make it work with framework 1.0?

Additionally, is there a way to make a .NET 2002 project work with framework 1.1?

Thanks in advance.

God Bless.



 Reply:
by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP])

 
You can do that with a config file. Notice that VS.NET 2003 will still
compile a .NET 1.1 assembly.

> Additionally, is there a way to make a .NET 2002 project work with framework 1.1?

I assume that .NET 1.0 projects will run on .NET 1.1 automatically, but
I never tested that. VS.NET 2002 can only create .NET 1.0 assemblies.
Both versions of the .NET Framework can be installed on the same machine:

"Side-by-Side Execution"
<URL:http://msdn.microsoft.com/library/en-us/dnnetdep/html/sidexsidenet.asp>

Version comparison
<URL:http://msdn.microsoft.com/netframework/productinfo/versioncomparison/>

General changes
<URL:http://www.gotdotnet.com/team/changeinfo/>

Class changes
<URL:http://www.gotdotnet.com/team/upgrade/apiChanges.aspx>

--
Herfried K. Wagner [MVP]


 Reply:
by:Ken Tucker [MVP]

 Hi,

In the project properties under common properties in build. You
will find supported runtimes click on the change button to change to
framework 1.0

Ken




Posted by Xander Zelders
0 Comments



.Net Assembly via VBS

Found the following interesting discussion in the Newsgroups:

.Net Assembly via VBS
by:JDP@Work

Can a .Net Assembly be instantiated from a VBS script?

TIA

JeffP.....


 Reply:
by:CJ Taylor

 Only if it exposes COM and the Framework is installed...



 Reply:
by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP])

 
How is this question related to the VB.NET programming language?

In the project options, check "register for COM interop" and then try to
use the object from within the VBScript (untested).

--
Herfried K. Wagner [MVP]



Posted by Xander Zelders
0 Comments



Need to include original DLL with Interop?

Found the following interesting discussion in the Newsgroups:

Need to include original DLL with Interop?
by:Tom

Hi,

I have developed a VB.NET app that is referencing and using an old ActiveX
component. When I add that reference to .NET, it of course generates an
interop file. My question is: If I include the interop file with the
application when deploying, do I need the original .dll object?

For example, say I am including an old ActiveX component called
OldActiveX.dll. .NET will generate an interop.OldActiveX.dll file. When I
get ready to deploy my application, can I just deploy the interop file? Or
do I have to deploy BOTH the interop file and the original OldActiveX.dll
file?

Tom


 Reply:
by:Marina

 I believe the wrapper is just that - all it does is marshall the calls to
the real DLL. It is not a converted version of the DLL - it just relays the
calls to the real thing.

So yes, you do need the original DLL (and probably need to register it as
well).



Posted by Xander Zelders
0 Comments



Datagrid with a combobox

Found the following interesting discussion in the Newsgroups:

datagrid with a combobox
by:Anonymous

OK. So I've been to http://www.syncfusion.com/FAQ/WinForms/FAQ_c44c.asp and learned a lot about what I might do with a datagrid. But I'm STILL not able to do what I want to do. I want to be able be able to enter data into my grid cell using a combobox. I want the combobox to display items based on my selected DisplayMember and update the datasource based on my selected ValueMember. So far, so good. But when the user leaves the combobox cell, I want the value of the DisplayMember to be displayed, not the ValueMember. The closest I've come to this is to Paint all the cells in the column with the same (most recently selected) DisplayMember value.

While I'm at it, I'd like to derive an inherited ComboBox that has a ValueMember, a DisplayMember, and a COLLECTION of DisplayColumns in the DropDown list. Any help?

Thanks,

Pat


 Reply:
by:Cor Ligthert

 Hi Pat,

Did you try this sample that I have made with as base the comboboxsample on
Syncfusion (which I modified). The modifed combobox class is at the end.

I hope this helps?

Cor
'\\\needs a datagrid and 2 buttons on a form
'Used for the comboboxcolumn is a modified sample from
'syncfusion
'To start do the Read/Create ds and cancel direct,
' than a start dataset will be created
Dim ds As New DataSet("Test")
Private Sub Form1_Load(ByVal sender As Object, ByVal e _
As System.EventArgs) Handles MyBase.Load
Me.Button1.Text = "Read/Create ds"
Me.Button2.Text = "Write ds"
End Sub
Private Sub FillGrid()
Dim dv As New DataView(ds.Tables(0))
dv.AllowNew = False
DataGrid1.DataSource = dv
Dim ts As New DataGridTableStyle
ts.MappingName = "Names"
Dim textCol As New DataGridTextBoxColumn
textCol.MappingName = "IdName"
textCol.HeaderText = "Id"
textCol.Width = 20
ts.GridColumnStyles.Add(textCol)
textCol = New DataGridTextBoxColumn
textCol.MappingName = "Name"
textCol.HeaderText = "Name"
textCol.Width = 120
ts.GridColumnStyles.Add(textCol)
Dim cmbTxtCol As New DataGridComboBoxColumn
cmbTxtCol.MappingName = "Country"
cmbTxtCol.HeaderText = "Countries"
cmbTxtCol.Width = 100
ts.GridColumnStyles.Add(cmbTxtCol)
ts.PreferredRowHeight = (cmbTxtCol.ColumnComboBox.Height + 3)
cmbTxtCol.ColumnComboBox.DataSource = ds.Tables(1)
cmbTxtCol.ColumnComboBox.DisplayMember = "Country"
cmbTxtCol.ColumnComboBox.ValueMember = "IdCountry"
cmbTxtCol.ColumnComboBox.DropDownStyle = ComboBoxStyle.DropDownList
DataGrid1.TableStyles.Add(ts)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button2.Click
Dim of As New SaveFileDialog
If of.ShowDialog = DialogResult.OK Then
ds.WriteXml(of.FileName)
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Dim fo As New OpenFileDialog
If fo.ShowDialog() = DialogResult.OK Then
ds.ReadXml(fo.FileName)
Else
Dim dtName As New DataTable("Names")
Dim dcIdName As New DataColumn("IdName")
Dim dcName As New DataColumn("Name")
Dim dcCountryN As New DataColumn("Country")
dtName.Columns.Add(dcIdName)
dtName.Columns.Add(dcName)
dtName.Columns.Add(dcCountryN)
ds.Tables.Add(dtName)
For i As Integer = 1 To 6
Dim dr As DataRow = dtName.NewRow
dr(0) = i.ToString
dtName.Rows.Add(dr)
Next
dtName.Rows(0)(1) = "Herfried K. Wagner"
dtName.Rows(1)(1) = "Armin Zingler"
dtName.Rows(2)(1) = "Ken Tucker"
dtName.Rows(3)(1) = "CJ Taylor"
dtName.Rows(4)(1) = "Jay B Harlow"
dtName.Rows(5)(1) = "Cor Ligthert"
dtName.Rows(0)(2) = "Austria(EU)"
dtName.Rows(1)(2) = "Germany(EU)"
dtName.Rows(2)(2) = "Georgia(US)"
dtName.Rows(3)(2) = "Illinois(US)"
dtName.Rows(4)(2) = "New York(US)"
dtName.Rows(5)(2) = "Holland(EU)"
Dim dtCountry As New DataTable("Countries")
Dim dcIdCountry As New DataColumn("IDCountry")
Dim dcCountry As New DataColumn("Country")
dtCountry.Columns.Add(dcIdCountry)
dtCountry.Columns.Add(dcCountry)
ds.Tables.Add(dtCountry)
For i As Integer = 1 To 6
Dim dr As DataRow = dtCountry.NewRow
dr(0) = i.ToString
dtCountry.Rows.Add(dr)
Next
dtCountry.Rows(0)(1) = "Austria(EU)"
dtCountry.Rows(1)(1) = "Germany(EU)"
dtCountry.Rows(2)(1) = "Holland(EU)"
dtCountry.Rows(3)(1) = "Georgia(US)"
dtCountry.Rows(4)(1) = "Illinois(US)"
dtCountry.Rows(5)(1) = "New York(US)"
End If
FillGrid()
End Sub
End Class
Public Class DataGridComboBoxColumn
Inherits DataGridTextBoxColumn
Public WithEvents ColumnComboBox As NoKeyUpCombo 'special class
Private WithEvents cmSource As CurrencyManager
Private mRowNum As Integer
Private isEditing As Boolean
Shared Sub New()
End Sub
Public Sub New()
MyBase.New()
ColumnComboBox = New NoKeyUpCombo
AddHandler ColumnComboBox.SelectionChangeCommitted, _
New EventHandler(AddressOf ComboStartEditing)
End Sub
Protected Overloads Overrides Sub Edit(ByVal source As CurrencyManager,
_
ByVal rowNum As Integer, ByVal bounds As Rectangle, ByVal readOnly1 As
Boolean, _
ByVal instantText As String, ByVal cellIsVisible As Boolean)
MyBase.Edit(source, rowNum, bounds, readOnly1, instantText,
cellIsVisible)
mRowNum = rowNum
cmSource = source
ColumnComboBox.Parent = Me.TextBox.Parent
ColumnComboBox.Location = Me.TextBox.Location
ColumnComboBox.Size = New Size(Me.TextBox.Size.Width,
ColumnComboBox.Size.Height)
ColumnComboBox.Text = Me.TextBox.Text
TextBox.Visible = False
ColumnComboBox.Visible = True
ColumnComboBox.BringToFront()
ColumnComboBox.Focus()
End Sub
Protected Overloads Overrides Function Commit(ByVal dataSource As _
CurrencyManager, ByVal rowNum As Integer) As Boolean
If isEditing Then
isEditing = False
SetColumnValueAtRow(dataSource, rowNum, ColumnComboBox.Text)
End If
Return True
End Function
Private Sub ComboStartEditing(ByVal sender As Object, ByVal e As
EventArgs)
isEditing = True
MyBase.ColumnStartedEditing(DirectCast(sender, Control))
End Sub
Private Sub LeaveComboBox(ByVal sender As Object, ByVal e As EventArgs)
_
Handles ColumnComboBox.Leave
If isEditing Then
SetColumnValueAtRow(cmSource, mRowNum, ColumnComboBox.Text)
isEditing = False
Invalidate()
End If
ColumnComboBox.Hide()
End Sub
End Class
Public Class NoKeyUpCombo
Inherits ComboBox
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
If m.Msg <> &H101 Then
MyBase.WndProc(m)
End If
End Sub
///


 Reply:
by:Anonymous

 Thanks for the response.

This looks very similar to the syncfusion implementation. I have not actually tried to run yours, but I still don't see how it will work as I want. Specifically, I want to DISPLAY the ComboBox's DisplayMember value in the datagrid, but STORE the ComboBox's ValueMember in the DataGrid's datasource. It appears that your example (and all others that I've looked at), either store AND display the DisplayMember, or store AND display the ValueMember. Here is a listing of what I'm trying to do by intercepting the Paint method. It doesn't actually work, but I THINK I'm on the right track. In particular, have a look at the GetColumnTextAtRow function. Any advice?

Public Class DataGridComboBoxColumn
Inherits DataGridColumnStyle
'
' UI constants
'
Private xMargin As Integer = 2
Private yMargin As Integer = 1
Private WithEvents Combo As DataGridComboBox
Private WithEvents tb As TextBox
Private _DisplayMember As String
Private _ValueMember As String
Private _rowNum As Integer
Private WithEvents _source As CurrencyManager
'
' Used to track editing state
'
Private OldVal As String = String.Empty
Private InEdit As Boolean = False


Public Property ComboBox() As DataGridComboBox
Get
Return Combo
End Get
Set(ByVal Value As DataGridComboBox)
Combo = Value
End Set
End Property

Protected Overloads Overrides Sub Paint(ByVal g As Graphics, _
ByVal Bounds As Rectangle, _
ByVal Source As CurrencyManager, _
ByVal RowNum As Integer, _
ByVal AlignToRight As Boolean)
Dim Text As String = GetText(GetColumnTextAtRow(Source, RowNum))
PaintText(g, Bounds, Text, AlignToRight)
End Sub
Private Function GetText(ByVal Value As Object) As String
If Not Value Is Nothing Then
Debug.WriteLine("GetText(" & Value.ToString & ")")
Else
Debug.WriteLine("GetText(Value is Nothing)")
End If
If Value Is System.DBNull.Value Then Return NullText

If Not Value Is Nothing Then
Debug.WriteLine(Value.ToString)
Return Value.ToString
Else
Debug.WriteLine("Value is Nothing")
Return String.Empty
End If

End Function

Private Sub PaintText(ByVal g As Graphics, _
ByVal Bounds As Rectangle, _
ByVal Text As String, _
ByVal AlignToRight As Boolean)

Debug.WriteLine("PaintText(1)")
Dim BackBrush As Brush = New SolidBrush(Me.DataGridTableStyle.BackColor)
Dim ForeBrush As Brush = New SolidBrush(Me.DataGridTableStyle.ForeColor)
PaintText(g, Bounds, Text, BackBrush, ForeBrush, AlignToRight)
End Sub

Private Function GetColumnTextAtRow(ByVal Source As CurrencyManager, ByVal RowNum As Integer) As Object
Dim value As Object = Me.GetColumnValueAtRow(Source, RowNum)
Dim dSource As Object
Dim dr As DataRow

dSource = Combo.DataSource
If value Is System.DBNull.Value Then
Return NullText
End If
If Not dSource Is Nothing Then
If TypeOf dSource Is DataTable Then
dSource = CType(dSource, DataTable)
If Not dSource.Columns.Contains(Combo.DisplayMember) _
OrElse Not dSource.Columns.Contains(Combo.ValueMember) Then
Return NullText
End If
For Each dr In dSource.Rows
If value = dr(Combo.ValueMember) Then
Return dr(Combo.DisplayMember)
End If
Next
Return NullText
ElseIf TypeOf dSource Is DataView Then
dSource = CType(dSource, DataView)
If Not dSource.Table.Columns.Contains(Combo.DisplayMember) _
OrElse Not dSource.Table.Columns.Contains(Combo.ValueMember) Then
Return value
End If
For Each dr In dSource.Table.Rows
If value = dr(Combo.ValueMember) Then
Return dr(Combo.DisplayMember)
End If
Next
Return NullText
End If
End If
End Function

Private Sub Combo_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Combo.SelectedIndexChanged
tb.Text = CType(sender, ComboBox).Text
End Sub

Public Class DataGridComboBox
Inherits ComboBox
Public Sub New()
MyBase.New()
End Sub

Private _modified As Boolean = False

Public isInEditOrNavigateMode As Boolean = True

Public Property Modified() As Boolean
Get
Return _modified
End Get
Set(ByVal Value As Boolean)
_modified = Value
End Set
End Property

End Class

End Class


 Reply:
by:Anonymous

 Update. The following code does what I want it to do, but moves slower than molasses in January. Any advice on speeding it up. I believe that it has to do with passing the ComboBox's datasource around.

Option Strict Off
Option Explicit On
Imports System.Collections
Imports System.ComponentModel
Imports System.Drawing
Imports System.Windows.Forms
Imports System.Data

Namespace DataGridComboBoxColumnStyle
Public Class DataGridComboBox
Inherits ComboBox
Public Sub New()
MyBase.New()
End Sub

Private _modified As Boolean = False

Public isInEditOrNavigateMode As Boolean = True

Public Property Modified() As Boolean
Get
Return _modified
End Get
Set(ByVal Value As Boolean)
_modified = Value
End Set
End Property

End Class
Public Class DataGridComboBoxColumn
Inherits DataGridColumnStyle
'
' UI constants
'
Private xMargin As Integer = 2
Private yMargin As Integer = 1
Private WithEvents Combo As DataGridComboBox
Private WithEvents tb As TextBox
Private _DisplayMember As String
Private _ValueMember As String
Private _rowNum As Integer
Private WithEvents _source As CurrencyManager
'
' Used to track editing state
'
Private OldVal As String = String.Empty
Private InEdit As Boolean = False
'
' Create a new column - DisplayMember, ValueMember
' Passed by ordinal
'
Public Sub New()
Combo = New DataGridComboBox
Combo.Visible = False
tb = New TextBox
tb.Visible = False
End Sub

Public Sub New(ByRef DataSource As DataTable, _
ByVal DisplayMember As Integer, _
ByVal ValueMember As Integer)

Debug.WriteLine("New(1)")
Combo = New DataGridComboBox
_DisplayMember = DataSource.Columns.Item(index:=DisplayMember).ToString
_ValueMember = DataSource.Columns.Item(index:=ValueMember).ToString

With Combo
.Visible = False
.DataSource = DataSource
.DisplayMember = _DisplayMember
.ValueMember = _ValueMember
End With
tb = New TextBox
With tb
.Visible = False
End With
End Sub
'
' Create a new column - DisplayMember, ValueMember
' passed by string
'
Public Sub New(ByRef DataSource As DataTable, _
ByVal DisplayMember As String, _
ByVal ValueMember As String)

Debug.WriteLine("New(2)")
Combo = New DataGridComboBox
With Combo
.Visible = False
.DataSource = DataSource
.DisplayMember = DisplayMember
.ValueMember = ValueMember
End With
tb = New TextBox
With tb
.Visible = False
End With
End Sub
Public Sub New(ByRef DataSource As DataView, _
ByVal DisplayMember As Integer, _
ByVal ValueMember As Integer)

Debug.WriteLine("New(3)")
Combo = New DataGridComboBox
_DisplayMember = DataSource.Table.Columns.Item(index:=DisplayMember).ToString
_ValueMember = DataSource.Table.Columns.Item(index:=ValueMember).ToString

With Combo
.Visible = False
.DataSource = DataSource
.DisplayMember = _DisplayMember
.ValueMember = _ValueMember
End With
tb = New TextBox
With tb
.Visible = False
End With
End Sub
'
' Create a new column - DisplayMember, ValueMember
' passed by string
'
Public Sub New(ByRef DataSource As DataView, _
ByVal DisplayMember As String, _
ByVal ValueMember As String)

Debug.WriteLine("New(4)")
Combo = New DataGridComboBox
With Combo
.Visible = False
.DataSource = DataSource
.DisplayMember = DisplayMember
.ValueMember = ValueMember
End With
tb = New TextBox
With tb
.Visible = False
End With
End Sub

'------------------------------------------------------
' Methods overridden from DataGridColumnStyle
'------------------------------------------------------
'
' Abort Changes
'
Protected Overloads Overrides Sub Abort(ByVal RowNum As Integer)
Debug.WriteLine("Abort()")
RollBack()
HideComboBox()
EndEdit()
End Sub
'
' Commit Changes
'
Protected Overloads Overrides Function Commit(ByVal DataSource As CurrencyManager, _
ByVal RowNum As Integer) As Boolean
Debug.WriteLine("Commit()")
HideComboBox()
_rowNum = RowNum
_source = DataSource
If Not InEdit Then
Return True
End If

Try
Dim Value As Object = Combo.SelectedValue
If NullText.Equals(Value) Then
Value = Convert.DBNull
End If
tb.Text = Combo.Text
SetColumnValueAtRow(DataSource, RowNum, Value)
Catch e As Exception
RollBack()
Return False
End Try
EndEdit()
Return True
End Function
'
' Remove focus
'
Protected Overloads Overrides Sub ConcedeFocus()
Debug.WriteLine("ConcedeFocus()")
Combo.Visible = False
End Sub
'
' Edit Grid
'
Protected Overloads Overrides Sub Edit(ByVal Source As CurrencyManager, _
ByVal Rownum As Integer, _
ByVal Bounds As Rectangle, _
ByVal [ReadOnly] As Boolean, _
ByVal InstantText As String, _
ByVal CellIsVisible As Boolean)

Debug.WriteLine("Edit()")
Combo.Text = String.Empty

Dim OriginalBounds As Rectangle = Bounds
Dim txt As String

OldVal = Combo.Text

If CellIsVisible Then
Bounds.Offset(xMargin, yMargin)
Bounds.Width -= xMargin * 2
Bounds.Height -= yMargin
Combo.Bounds = Bounds
Combo.Visible = True
Else
Combo.Bounds = OriginalBounds
Combo.Visible = False
End If

txt = tb.Text
If Not txt = InstantText Then
Combo.Modified = True
End If
If Not txt = NullText Then
Combo.SelectedValue = GetText(GetColumnValueAtRow(Source, Rownum))
End If

If Not InstantText Is Nothing Then
Combo.SelectedValue = InstantText
End If

Combo.RightToLeft = Me.DataGridTableStyle.DataGrid.RightToLeft
Combo.Focus()

If InstantText Is Nothing Then
Combo.SelectAll()
Else
Dim [End] As Integer = Combo.Text.Length
Combo.Select([End], 0)
End If

If Combo.Visible Then
DataGridTableStyle.DataGrid.Invalidate(OriginalBounds)
End If

InEdit = True

End Sub

Protected Overloads Overrides Function GetMinimumHeight() As Integer
'
' Set the minimum height to the height of the combobox
'
Debug.WriteLine("GetMinimumHeight()")
Return Combo.PreferredHeight + yMargin
End Function

Protected Overloads Overrides Function GetPreferredHeight(ByVal g As Graphics, _
ByVal Value As Object) As Integer
Debug.WriteLine("GetPreferredHeight()")
Dim NewLineIndex As Integer = 0
Dim NewLines As Integer = 0
Dim ValueString As String = Me.GetText(Value)
Do
While NewLineIndex <> -1
NewLineIndex = ValueString.IndexOf("r\n", NewLineIndex + 1)
NewLines += 1
End While
Loop

Return FontHeight * NewLines + yMargin
End Function

Protected Overloads Overrides Function GetPreferredSize(ByVal g As Graphics, _
ByVal Value As Object) As Size
Dim Extents As Size = Size.Ceiling(g.MeasureString(GetText(Value), _
Me.DataGridTableStyle.DataGrid.Font))
Debug.WriteLine("GetPreferredSize()")
Extents.Width += xMargin * 2 + DataGridTableGridLineWidth
Extents.Height += yMargin
Return Extents
End Function
Protected Overloads Overrides Sub Paint(ByVal g As Graphics, _
ByVal Bounds As Rectangle, _
ByVal Source As CurrencyManager, _
ByVal RowNum As Integer)
Debug.WriteLine("Paint(1)")
Paint(g, Bounds, Source, RowNum, False)
End Sub

Protected Overloads Overrides Sub Paint(ByVal g As Graphics, _
ByVal Bounds As Rectangle, _
ByVal Source As CurrencyManager, _
ByVal RowNum As Integer, _
ByVal AlignToRight As Boolean)
Debug.WriteLine("Paint(2)" & GetText(GetColumnValueAtRow(Source, RowNum)))
Dim Text As String = GetText(GetColumnTextAtRow(Source, RowNum))
PaintText(g, Bounds, Text, AlignToRight)
End Sub

Protected Overloads Sub Paint(ByVal g As Graphics, _
ByVal Bounds As Rectangle, _
ByVal Source As CurrencyManager, _
ByVal RowNum As Integer, _
ByVal BackBrush As Brush, _
ByVal ForeBrush As Brush, _
ByVal AlignToRight As Boolean)

Debug.WriteLine("Paint(3)")
Dim Text As String = GetText(GetColumnTextAtRow(Source, RowNum))
PaintText(g, Bounds, Text, BackBrush, ForeBrush, AlignToRight)
End Sub

Protected Overloads Overrides Sub SetDataGridInColumn(ByVal Value As DataGrid)
Debug.WriteLine("SetDataGridInColumn()")
MyBase.SetDataGridInColumn(Value)
If Not (Combo.Parent Is Value) Then
If Not (Combo.Parent Is Nothing) Then
Combo.Parent.Controls.Remove(Combo)
End If
End If

If Not (Value Is Nothing) Then Value.Controls.Add(Combo)
If Not (tb.Parent Is Value) Then
If Not (tb.Parent Is Nothing) Then
tb.Parent.Controls.Remove(tb)
End If
End If

If Not (Value Is Nothing) Then Value.Controls.Add(tb)
End Sub

Protected Overloads Overrides Sub UpdateUI(ByVal Source As CurrencyManager, _
ByVal RowNum As Integer, ByVal InstantText As String)
Debug.WriteLine("UpdateUI()")
Combo.Text = tb.Text
If Not (InstantText Is Nothing) Then
Combo.Text = InstantText
End If
End Sub

'----------------------------------------------------------------------
' Helper Methods
'----------------------------------------------------------------------

Public Property ComboBox() As DataGridComboBox
Get
Return Combo
End Get
Set(ByVal Value As DataGridComboBox)
Combo = Value
End Set
End Property

Private ReadOnly Property DataGridTableGridLineWidth() As Integer
Get
If Me.DataGridTableStyle.GridLineStyle = DataGridLineStyle.Solid Then
Return 1
Else
Return 0
End If
End Get
End Property

Private Sub EndEdit()
Debug.WriteLine("EndEdit()")
InEdit = False
Combo.Modified = False
Invalidate()
End Sub

Private Function GetText(ByVal Value As Object) As String
If Not Value Is Nothing Then
Debug.WriteLine("GetText(" & Value.ToString & ")")
Else
Debug.WriteLine("GetText(Value is Nothing)")
End If
If Value Is System.DBNull.Value Then Return NullText

If Not Value Is Nothing Then
Debug.WriteLine(Value.ToString)
Return Value.ToString
Else
Debug.WriteLine("Value is Nothing")
Return String.Empty
End If

End Function

Private Sub HideComboBox()
Debug.WriteLine("HideComboBox()")
If Combo.Focused Then
Me.DataGridTableStyle.DataGrid.Focus()
End If
Combo.Visible = False
End Sub

Private Sub RollBack()
Debug.WriteLine("RollBack()")
Combo.Text = OldVal
tb.Text = OldVal
Combo.Modified = False
End Sub

Private Sub PaintText(ByVal g As Graphics, _
ByVal Bounds As Rectangle, _
ByVal Text As String, _
ByVal AlignToRight As Boolean)

Debug.WriteLine("PaintText(1)")
Dim BackBrush As Brush = New SolidBrush(Me.DataGridTableStyle.BackColor)
Dim ForeBrush As Brush = New SolidBrush(Me.DataGridTableStyle.ForeColor)
PaintText(g, Bounds, Text, BackBrush, ForeBrush, AlignToRight)
End Sub

Private Sub PaintText(ByVal g As Graphics, _
ByVal TextBounds As Rectangle, _
ByVal Text As String, _
ByVal BackBrush As Brush, _
ByVal ForeBrush As Brush, _
ByVal AlignToRight As Boolean)

Debug.WriteLine("PaintText(2)" & Text)
Dim Rect As Rectangle = TextBounds
Dim RectF As RectangleF = RectF.op_Implicit(Rect) ' Convert to RectangleF
Dim Format As StringFormat = New StringFormat

If AlignToRight Then
Format.FormatFlags = StringFormatFlags.DirectionRightToLeft
End If

Select Case Me.Alignment
Case Is = HorizontalAlignment.Left
Format.Alignment = StringAlignment.Near
Case Is = HorizontalAlignment.Right
Format.Alignment = StringAlignment.Far
Case Is = HorizontalAlignment.Center
Format.Alignment = StringAlignment.Center
End Select

Format.FormatFlags = Format.FormatFlags Or StringFormatFlags.NoWrap
g.FillRectangle(Brush:=BackBrush, Rect:=Rect)

Rect.Offset(0, yMargin)
Rect.Height -= yMargin
g.DrawString(Text, Me.DataGridTableStyle.DataGrid.Font, ForeBrush, RectF, Format)
Format.Dispose()

End Sub

Private Function GetColumnTextAtRow(ByVal Source As CurrencyManager, ByVal RowNum As Integer) As Object
Dim value As Object = Me.GetColumnValueAtRow(Source, RowNum)
Dim dSource As Object

dSource = Combo.DataSource
If value Is System.DBNull.Value Then
Return NullText
End If
If Not dSource Is Nothing Then
If TypeOf dSource Is DataTable Then
Dim dr As DataRow
dSource = CType(dSource, DataTable)
If Not dSource.Columns.Contains(Combo.DisplayMember) _
OrElse Not dSource.Columns.Contains(Combo.ValueMember) Then
Return NullText
End If
For Each dr In dSource.Rows
If value = dr(Combo.ValueMember) Then
Return dr(Combo.DisplayMember)
End If
Next
Return NullText
ElseIf TypeOf dSource Is DataView Then
Dim drv As DataRowView
dSource = CType(dSource, DataView)
If Not dSource.Table.Columns.Contains(Combo.DisplayMember) _
OrElse Not dSource.Table.Columns.Contains(Combo.ValueMember) Then
Return NullText
End If
For Each drv In dSource
If value = drv(Combo.ValueMember) Then
Return drv(Combo.DisplayMember)
End If
Next
Return NullText
End If
End If
End Function

Private Sub Combo_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Combo.SelectedIndexChanged
tb.Text = CType(sender, ComboBox).Text
End Sub

End Class

End Namespace



Posted by Xander Zelders
0 Comments



Passing variables from page to control

Found the following interesting discussion in the Newsgroups:

passing variables from page to control
by:DC Gringo

I have a simple index.aspx page that declares and sets a sectionID in the
Page_Load. The in a user control later on in the page, I read the sectionID
variable (in the control's Page_Load) to determine which panel to show. It
does not work

"Name 'sectionID' is not declared" is my error while compiling the user
control.

What am I doing wrong?
This is in my main page's Page_Load

Dim sectionID As String = "about"
--
This is in my user control's Page_Load

If sectionID = "about" Then
pnlAbout.Visible = True
ElseIf sectionID = "home" Then
pnlHome.Visible = True
End If
_____
DC G


 Reply:
by:Steve C. Orr [MVP, MCSD]

 Make a public property or method on your control that accepts the value from
your page. Something like this:

Public Sub SetSection(Section as Integer)
'Now I have the value I need
End Sub

The from your page, call it like this to pass the value along:
MyControlName.SetSectionID(sectionID)

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net



Posted by Xander Zelders
0 Comments



Error: Argument 'Prompt' cannot be converted to type 'String'

Found the following interesting discussion in the Newsgroups:

Error: Argument 'Prompt' cannot be converted to type 'String'
by:carolinepsmith@hotmail.com (Caroline)

I am trying to update a record though a stored procedure and
parameters, but I keep getting this error:

Additional information: Argument 'Prompt' cannot be converted to type
'String'.
Any ideas?

Here is the code

Public Function UpdateClient()

Dim dapClients As System.Data.SqlClient.SqlDataAdapter = New
System.Data.SqlClient.SqlDataAdapter
'Specify a connection for a data adpter that
'fills the data set used on the form.
Dim conn As System.Data.SqlClient.SqlConnection _
= New System.Data.SqlClient.SqlConnection(Utilities.GetConnectionString())
'Specify the command and data adpter that serves
'as the source for the data set on the form
conn.Open()

Dim cmd As System.Data.SqlClient.SqlCommand = _
New System.Data.SqlClient.SqlCommand("UpdClient", conn)
cmd.CommandType = CommandType.StoredProcedure

'Declare Parameters
Dim prmClientID As SqlClient.SqlParameter = _
cmd.Parameters.Add("@ClientID", SqlDbType.Int, 4,
"ClientID")
prmClientID.Direction = ParameterDirection.Input
prmClientID.IsNullable = False
prmClientID.Value = CInt(ClientID)

Dim prmClientCode As SqlClient.SqlParameter = _
cmd.Parameters.Add("@ClientCode", SqlDbType.Char, 10,
"ClientCode")
prmClientCode.Direction = ParameterDirection.Input
prmClientCode.IsNullable = False
prmClientCode.Value = ClientCode

Dim prmClientName As SqlClient.SqlParameter = _
cmd.Parameters.Add("@ClientName", SqlDbType.Char, 50,
"ClientName")
prmClientName.Direction = ParameterDirection.Input
prmClientName.IsNullable = True
prmClientName.Value = Name

Dim prmClientDescription As SqlClient.SqlParameter = _
cmd.Parameters.Add("@ClientDescription", SqlDbType.Char,
255, "ClientDescription")
prmClientDescription.Direction = ParameterDirection.Input
prmClientDescription.IsNullable = True
prmClientDescription.Value = ClientDescription

Dim prmBillingContact As SqlClient.SqlParameter = _
cmd.Parameters.Add("@BillingContact", SqlDbType.Char, 50,
"BillingContact")
prmBillingContact.Direction = ParameterDirection.Input
prmBillingContact.IsNullable = True
prmBillingContact.Value = BillingContact

Dim prmOtherContact As SqlClient.SqlParameter = _
cmd.Parameters.Add("@OtherContact", SqlDbType.Char,
50, "OtherContact")
prmOtherContact.Direction = ParameterDirection.Input
prmOtherContact.IsNullable = True
prmOtherContact.Value = OtherContact

Dim prmOtherContactDesc As SqlClient.SqlParameter = _
cmd.Parameters.Add("@OtherContactDesc",
SqlDbType.Char, 255, "OtherContactDesc")
prmOtherContactDesc.Direction = ParameterDirection.Input
prmOtherContactDesc.IsNullable = True
prmOtherContactDesc.Value = OtherContactDesc

Dim prmStreetAddress As SqlClient.SqlParameter = _
cmd.Parameters.Add("@StreetAddress", SqlDbType.Char, 150,
"StreetAddress")
prmStreetAddress.Direction = ParameterDirection.Input
prmStreetAddress.IsNullable = True
prmStreetAddress.Value = StreetAddress

Dim prmStreetCity As SqlClient.SqlParameter = _
cmd.Parameters.Add("@StreetCity", SqlDbType.Char, 50,
"StreetCity")
prmStreetCity.Direction = ParameterDirection.Input
prmStreetCity.Value = StreetCity

Dim prmStreetState As SqlClient.SqlParameter = _
cmd.Parameters.Add("@StreetState", SqlDbType.Char, 2,
"StreetState")
prmStreetState.Direction = ParameterDirection.Input
prmStreetState.IsNullable = True
prmStreetState.Value = StreetState

Dim prmStreetZip As SqlClient.SqlParameter = _
cmd.Parameters.Add("@StreetZip", SqlDbType.Char, 10,
"StreetZip")
prmStreetZip.Direction = ParameterDirection.Input
prmStreetZip.IsNullable = True
prmStreetZip.Value = StreetZip

Dim prmMailSameAsStreet As SqlClient.SqlParameter = _
cmd.Parameters.Add("@MailSameAsStreet", SqlDbType.Bit, 1)
prmMailSameAsStreet.Direction = ParameterDirection.Input
prmMailSameAsStreet.IsNullable = True
prmMailSameAsStreet.Value = MailSameAsStreet

Dim prmMailAddress As SqlClient.SqlParameter = _
cmd.Parameters.Add("@MailAddress", SqlDbType.Char, 150,
"MailAddress")
prmMailAddress.Direction = ParameterDirection.Input
prmMailAddress.IsNullable = True
prmMailAddress.Value = MailAddress

Dim prmMailCity As SqlClient.SqlParameter = _
cmd.Parameters.Add("@MailCity", SqlDbType.Char, 50,
"MailCity")
prmMailCity.Direction = ParameterDirection.Input
prmMailCity.IsNullable = True
prmMailCity.Value = MailCity

Dim prmMailState As SqlClient.SqlParameter = _
cmd.Parameters.Add("@MailState", SqlDbType.Char, 2,
"MailState")
prmMailState.Direction = ParameterDirection.Input
prmMailState.IsNullable = True
prmMailState.Value = MailState

Dim prmMailZip As SqlClient.SqlParameter = _
cmd.Parameters.Add("@MailZip", SqlDbType.Char, 10,
"MailZip")
prmMailZip.Direction = ParameterDirection.Input
prmMailZip.IsNullable = True
prmMailZip.Value = MailZip

Dim prmPhone As SqlClient.SqlParameter = _
cmd.Parameters.Add("@Phone", SqlDbType.Char, 10, "Phone")
prmPhone.Direction = ParameterDirection.Input
prmPhone.IsNullable = True
prmPhone.Value = Phone

Dim prmExtention As SqlClient.SqlParameter = _
cmd.Parameters.Add("@Extention", SqlDbType.Char, 10,
"Extention")
prmExtention.Direction = ParameterDirection.Input
prmExtention.IsNullable = True
prmExtention.Value = Extention

Dim prmFax As SqlClient.SqlParameter = _
cmd.Parameters.Add("@Fax", SqlDbType.Char, 10, "Fax")
prmfax.Direction = ParameterDirection.Input
prmfax.IsNullable = True
prmfax.Value = Fax

Dim prmComments As SqlClient.SqlParameter = _
cmd.Parameters.Add("@Comments", SqlDbType.Char, 255,
"Comments")
prmComments.Direction = ParameterDirection.Input
prmComments.IsNullable = True
prmComments.Value = Comments

Dim prmNumberOfPhotos As SqlClient.SqlParameter = _
cmd.Parameters.Add("@NumberOfPhotos", SqlDbType.Int,
4)
prmNumberOfPhotos.Direction = ParameterDirection.Input
prmNumberOfPhotos.IsNullable = True
prmNumberOfPhotos.Value = CInt(NumberOfPhotos)

Dim prmActive As SqlClient.SqlParameter = _
cmd.Parameters.Add("@Active", SqlDbType.Bit, 1)
prmActive.Direction = ParameterDirection.Input
prmActive.IsNullable = True
prmActive.Value = Active

Dim prmConfirmationLetter As SqlClient.SqlParameter = _
cmd.Parameters.Add("@ConfirmationLetter",
SqlDbType.Bit, 1)
prmConfirmationLetter.Direction = ParameterDirection.Input
prmConfirmationLetter.IsNullable = True
prmConfirmationLetter.Value = ConfirmationLetter

Dim prmInspectLockOuts As SqlClient.SqlParameter = _
cmd.Parameters.Add("@InspectLockOuts", SqlDbType.Bit, 1)
prmInspectLockOuts.Direction = ParameterDirection.Input
prmInspectLockOuts.IsNullable = True
prmInspectLockOuts.Value = InspectLockOuts

Dim prmCreditMaterialOS As SqlClient.SqlParameter = _
cmd.Parameters.Add("@CreditMaterialOS", SqlDbType.Bit, 1)
prmCreditMaterialOS.Direction = ParameterDirection.Input
prmCreditMaterialOS.IsNullable = True
prmCreditMaterialOS.Value = CreditMaterialOS

Dim prmLastEditedUserID As SqlClient.SqlParameter = _
cmd.Parameters.Add("@LastEditedUserID", SqlDbType.Int, 4)
prmLastEditedUserID.Direction = ParameterDirection.Input
prmLastEditedUserID.IsNullable = False
prmLastEditedUserID.Value = LastEditedUserId

Dim rows As Integer = cmd.ExecuteNonQuery()

If rows = 0 Then
MsgBox("Did not work")
Else
MsgBox("Worked")
End If

conn.Close()

End Function
'''''''''''''''''''''''''''
Store Procedure
'''''''''''''''''''''''''''
CREATE procedure updClient
@ClientID int,
@ClientCode char(10),
@ClientName Char(50),
@ClientDescription Char(255),
@BillingContact char(10),
@OtherContact char(50),
@OtherContactDesc char(255),
@StreetAddress char(150),
@StreetCity char(50),
@StreetState char(2),
@StreetZip char(10),
@MailSameAsStreet bit,
@MailAddress char(150),
@MailCity char(50),
@MailState char(2),
@MailZip char(10),
@Phone char(10),
@Extention char(10),
@Fax char(10),
@Comments char(255),
@NumberOfPhotos int,
@Active bit,
@ConfirmationLetter bit,
@InspectLockOuts bit,
@CreditMaterialsOS bit,
@LastEditedUserID int


as
Update clients set ClientCode = @ClientCode,
ClientDescription =@ClientDescription,
ClientName =@ClientName,
BillingContact= @BillingContact,
OtherContact = @OtherContact,
OtherContactDesc = @OtherContactDesc,
StreetAddress = @StreetAddress,
StreetCity = @StreetCity,
StreetState = @StreetState,
StreetZip = @Streetzip,
MailSameAsStreet = @MailSameAsStreet,
MailAddress = @MailAddress,
MailCity = @MailCity,
MailState = @MailState,
MailZip = @MailZip,
Phone = @Phone,
Extention = @Extention,
Fax = @Fax,
Comments = @Comments,
NumberOFPhotos = @NumberOfPhotos,
Active = @Active ,
ConfirmationLetter = @ConfirmationLetter,
InspectLockOuts = @InspectLockOuts,
CreditMaterialOS = @CreditMaterialsOS,
LastEditedUserId = @LastEditedUserID,
LastEditedTime = getdate()
Where Clients.ClientID = @ClientID
GO


 Reply:
by:Armin Zingler

 
Is it a compile error or a runtime error? At which line?
If it's an ADO.net problem, please turn to
microsoft.public.dotnet.framework.adonet
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html




Posted by Xander Zelders
1 Comments



Drawing XY coords on a form

Found the following interesting discussion in the Newsgroups:

Drawing XY coords on a form
by:Anonymous

Hi

I have signatures(can also say freehand sketches) drawn on the form using xy coordinates and stored them in 'image' datatype of sql server 2000 table.

I want to extract them from database table and draw them on another application in vb.net form as X & Y points/coords and make an image of signature again.

Is there a way to do this?

Your help/ suggestions is greatly appreciated.

Thanks,
PS


 Reply:
by:craigv_@online.microsoft.com (Craig Vick [MSFT])

 Hi PS,

You can use a Graphics object from the form (Form.CreateGraphics) and it
has all kinds of drawing methods (including DrawLine).

Hope this helps,
Craig VB .Net Team
--------------------------------------------------------------------
This reply is provided AS IS, without warranty (express or implied).

I have signatures(can also say freehand sketches) drawn on the form using
xy coordinates and stored them in 'image' datatype of sql server 2000 table.

I want to extract them from database table and draw them on another
application in vb.net form as X & Y points/coords and make an image of
signature again.

Is there a way to do this?

Your help/ suggestions is greatly appreciated.

Thanks,
PS
>



 Reply:
by:Anonymous

 Hi Craig,

Thanks for your reply. I want to extract the data from image datatype of sql server 2000 table. The data seems to be like this:
0x400052004100520041005300420053004200540042005500430056004300580044005A0044005B0044005F00440062004600660048006A0048006C004A006F004A0072004B0073004B0075004B0076004C0077004C0078004D0078004D0077004D0075004D0072004D0071004D006F004D006D004C006A004B0067004B0065

I think the data in image datatype is in binary data. How to get this data as xy points so that i can draw on form?

Your help is greatly appreciated.

Thanks,
PS

----- Craig Vick [MSFT] wrote: -----

Hi PS,

You can use a Graphics object from the form (Form.CreateGraphics) and it
has all kinds of drawing methods (including DrawLine).

Hope this helps,
Craig VB .Net Team
--------------------------------------------------------------------
This reply is provided AS IS, without warranty (express or implied).


I have signatures(can also say freehand sketches) drawn on the form using
xy coordinates and stored them in 'image' datatype of sql server 2000 table.

I want to extract them from database table and draw them on another
application in vb.net form as X & Y points/coords and make an image of
signature again.

Is there a way to do this?

Your help/ suggestions is greatly appreciated.

Thanks,
PS


>


 Reply:
by:Anonymous

 Hi Craig ,

Can you explain me, how to convert DIB(device independent Bitmaps) to Bitmaps in vb.net? I have to convert the DIBs to Bitmaps and then load them into picture box in vb.net form.

I greatly appreciate your help/suggestion.

Thanks in advance...


----- Craig Vick [MSFT] wrote: -----

Hi PS,

You can use a Graphics object from the form (Form.CreateGraphics) and it
has all kinds of drawing methods (including DrawLine).

Hope this helps,
Craig VB .Net Team
--------------------------------------------------------------------
This reply is provided AS IS, without warranty (express or implied).

I have signatures(can also say freehand sketches) drawn on the form using
xy coordinates and stored them in 'image' datatype of sql server 2000 table.

I want to extract them from database table and draw them on another
application in vb.net form as X & Y points/coords and make an image of
signature again.

Is there a way to do this?

Your help/ suggestions is greatly appreciated.

Thanks,
PS


>


 Reply:
by:craigv_@online.microsoft.com (Craig Vick [MSFT])

 I'll see what I can find out. There are WinAPIs (CreateDIBitmap) that do
this, but there's probably an easier way.

Craig VB.Net Team
--------------------------------------------------------------------
This reply is provided AS IS, without warranty (express or implied).

Can you explain me, how to convert DIB(device independent Bitmaps) to
Bitmaps in vb.net? I have to convert the DIBs to Bitmaps and then load
them into picture box in vb.net form.

I greatly appreciate your help/suggestion.

Thanks in advance...


----- Craig Vick [MSFT] wrote: -----

Hi PS,

You can use a Graphics object from the form (Form.CreateGraphics) and
it
has all kinds of drawing methods (including DrawLine).

Hope this helps,
Craig VB .Net Team
--------------------------------------------------------------------
This reply is provided AS IS, without warranty (express or implied).

I have signatures(can also say freehand sketches) drawn on the form
using
xy coordinates and stored them in 'image' datatype of sql server 2000
table.

I want to extract them from database table and draw them on another
application in vb.net form as X & Y points/coords and make an image of
signature again.

Is there a way to do this?

Your help/ suggestions is greatly appreciated.

Thanks,
PS




Posted by Xander Zelders
0 Comments



webBrowser control

Found the following interesting discussion in the Newsgroups:

webBrowser control
by:KC

Is the webBrowser control included in VB.net standard? I can't seem to find
it. Or do I have to create a certain type of solution?

Ken


 Reply:
by:Cor Ligthert

 Hi KC,

When it is not, take this link it is complete with a sample

webbrowser
http://support.microsoft.com/?kbid=311303

I hope this helps a little bit?

Cor


 Reply:
by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP])

 
You can use it after completing the steps described here:

311303 WebOCHostVB.exe Hosts the WebBrowser Control in Visual Basic .NET
<URL:http://support.microsoft.com/?id=311303>

--
Herfried K. Wagner [MVP]


 Reply:
by:KC

 Hey, thanks!

I got the control up and running, but it doesn't seem like you can actually
"do" anything with it. You know what I mean? At the end of the day all I
want to do is pull data off a page. The page I want (raw text data from a
switch which is in a .gz file) downloads to Internet Explorer, and the
webBrowser control, just fine, but I can't read the data once it's there -
well, actually I can, but I get garbage characters.

I figured once the data was in this control I could do some kind of 'view
source' in my code and get what I want.

Ken



Posted by Xander Zelders
0 Comments



remoteing setup

Found the following interesting discussion in the Newsgroups:

remoteing setup
by:Brian Henry

I have a server which uses remoteing and it works on a few systems but on
the server we want it to run on it always returns the error "internal server
error" back to the client application as an exception... but when we run the
server app on a windows xp pro box or a secondary windows 2000 server box it
works perfectly... what settings should i check? any security problems i
should look at in the 2000 server box that it wont work on? for a while it
was throwing exceptions back on that box when the app was starting, then i
ran the fix an app wizard and changed the mode to safe mode for the .net app
and it loaded, what should i be looking at to try to trouble shoot this?
thanks


 Reply:
by:Brian Henry

 also here is the error message from the client.....

"Server encountered an internal error. for mor information, turn on
customErrors in the server's .config file"

how do i do this? what is the correct tag and what level should it be placed
at in the config file? thanks


 Reply:
by:v-phuang@online.microsoft.com (Peter Huang)

 Hi Bian,

First of all, I would like to confirm my understanding of your issue.
From your description, I understand that you have a remoting server which
will start by reading the config file. The remoting server will run well on
many servers, but on certain server, the remoting server will encounter
error.
I did not understand your meaning very well at the point, when the remoting
server start, will it report any error? Or it will not report error, but
when you start the client on another machine or on the local machine, the
client will get the error?

I think you may follow the instruction you post in another post, that turn
on the customErrors for detailed error information.
<customErrors> Element
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/ht
ml/gnconcustomerrorselement.asp

You may try to check if the port used by the remoting has been used by
other application on the "problem" server?
You may also try to start the remoting server and remoting client by coding
not by the configuration file.
Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.



 Reply:
by:Brian Henry

 hello Peter,

we tracked down the problem and it turned out to be a DNS server problem, we
corrected it by changeing the DNS server, thanks for the help



Posted by Xander Zelders
0 Comments



Does file exist

Found the following interesting discussion in the Newsgroups:

Does file exist
by:y1799@yahoo.com (Mike)

Hi,

I am looking for function in .Net library that let me know if exist
any file if I specified template.

Eg: I specify "*.txt" and if any file (1.txt, 2.txt, .. ) exists then
I can get True or at least file name . And if does not exist Fasle or
empty string.

Of course I can use VB6 function Dir, but maybe .Net contains
something inside the class library.

Thanks


 Reply:
by:Sven Groot

 
Dim path As String = "c:\test" ' or some other directory
Dim files() As String = System.IO.Directory.GetFiles(path, "*.txt")

--
Sven Groot

http://unforgiven.bloghorn.com


 Reply:
by:Stephany

 Just remember that there is a gotcha when using the

Dim files() As String = System.IO.Directory.GetFiles(path, "*.txt")

functionality where the pattern has a 3 character extension. This will
return information for any file in path having an extension that starts with
..txt, (i.e., .txta, .txtb, .txtaa, .txtab, etc.). For extensions of any
other length this is not an issue. Don't ask me why the Redmond gurus made
it that way (I see it as a bug), but it's in the doc's as a design feature.


 Reply:
by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP])

 
\\If System.IO.Directory.GetFiles("C:\foo\*.exe").Length > 0 Then
MsgBox("File(s) exist!")
Else
MsgBox("Files do not exist!")
End If
///

--
Herfried K. Wagner [MVP]


 Reply:
by:Stephany

 Just remember that there is a gotcha when using the

Dim files() As String = System.IO.Directory.GetFiles(path, "*.txt")

functionality where the pattern has a 3 character extension. This will
return information for any file in path having an extension that starts with
..txt, (i.e., .txta, .txtb, .txtaa, .txtab, etc.). For extensions of any
other length this is not an issue. Don't ask me why the Redmond gurus made
it that way (I see it as a bug), but it's in the doc's as a design feature.

So, for the example to work correclty it needs to be:

Dim _ss() As String = System.IO.Directory.GetFiles("C:\foo", "*.exe")

Dim _f As Boolean = False

For Each _s As String In _ss
If System.IO.Path.GetExtension(_s) = ".exe") Then
_f = True
Exit For
End If
Next

If _f Then
MsgBox("File(s) exist!")
Else
MsgBox("Files do not exist!")
End If



Posted by Xander Zelders
0 Comments



Why TextAlign in ListView doesn't work!

Found the following interesting discussion in the Newsgroups:

Why TextAlign in ListView doesn't work!
by:Anonymous

Hi,
Does anyone knows how to aligh item in Listview. When i aligh a member item of a columns in a Listview control from Left to Center. It seems it doesn't save it and change it back to Left. Has anyone seen this problem? Any remedy for it?
Thanks
Keith B.



 Reply:
by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP])

 * =?Utf-8?B?S2VpdGggQnV0bGVy?= <anonymous@discussions.microsoft.com> scripsit:
> Does anyone knows how to aligh item in Listview. When i aligh a member item of a columns in a Listview control from Left to Center. It seems it doesn't save it and change it back to Left. Has anyone seen this problem? Any remedy for it?

Alignment only works in 'Details' view, and only for subitems, not for
the first column.

--
Herfried K. Wagner [MVP]


 Reply:
by:Anonymous

 Thanks
Keith



Posted by Xander Zelders
0 Comments



Having trouble with stdregprov and uintvalue.

Found the following interesting discussion in the Newsgroups:

Having trouble with stdregprov and uintvalue..
by:Text

I'm trying to invoke the createkey method under StdRegProv but I can't seem
to get the first
imparam correct

it says that "Value was either too large or too small for a UInt32 when it
processes current_user."

how do I pass a UInt32 value? Msdn has it listed as 0x80000001, but
vb.net won't except that. hDefKey only accepts uint32 values... or so it
seems.
Const HKEY_current_user As Long = &H80000001

Dim strkeypath As Object = "Software\Microsoft\Internet Explorer\Main\mas"

Dim wmi As ManagementClass

Dim md As MethodData

Dim RemotePC As String

RemotePC = "."

wmi = New ManagementClass("\\" & RemotePC & "\root\default:StdRegProv")

Dim inParams As ManagementBaseObject = wmi.GetMethodParameters("Createkey")

inParams("hDefKey") = HKEY_current_user

inParams("sSubKeyName") = strkeypath

Dim outParams As ManagementBaseObject = wmi.InvokeMethod("Createkey",
inParams, Nothing)

' Display results

' Note: The return code of the method is provided in the "returnValue"
property of the outParams object

Console.WriteLine("Creation of registry returned: {0}",
outParams("returnValue"))


----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---


 Reply:
by:Olivier DALET

 Two answers:
- first and best one (to me): use C# which provides unsigned types (uint,
ulong, ...):
const uint HKEY_current_user = 0x80000001;

- second one: using VB, I wrote this horrible (but working) piece of code:
Const HKEY_current_user As String = "80000001"
...
inParams("hDefKey") = UInt32.Parse(HKEY_current_user,
System.Globalization.NumberStyles.HexNumber)

Maybe somebody will find a cleaner solution using VB ?...

Olivier DALET



Posted by Xander Zelders
0 Comments



Problem with sending hex in UDP packet

Found the following interesting discussion in the Newsgroups:

Problem with sending hex in UDP packet
by:spammersarevermin

I'm trying to put some hex values in a UDP packet & I don't have a
clue how to accomplish this. Using the code below results in a packet
going out w/ the right buffer length but all 00's as the data payload.
Any help is appreciated. Sorry for the wrap.

Thanks
Public Function SendData() As IAsyncResult
Try

' Get remote host IP address or hostname
Dim re_port As Integer = 1719 ' port 1719 for RAS
Dim udpClient As New UdpClient
Dim epremote As New IPEndPoint _
(IPAddress.Parse(TextBox1.Text), re_port)
Dim timeout As Integer = CInt(TextBox3.Text)
Dim i As Integer
Dim sendbuffer As [Byte]() = {&H30, &H20, &H0, &H0, &H60,
&H0, _
&H80, &H91, &H4A, &H00, &H20, &H0, &HA, &H60, &H86, &H48, &H1, _
&H86, &HF8, &H72, &H40, &H20, &H10, &H30, &H85, &H10, &H40, &H0, _
&HC0, &HA8, &HB, &H16, &HC0, &H94, &H20, &H0, &H10, &H10, &H80, _
&H43, &H36, &HC0, &H30, &H20, &H10, &H10, &H11, &H20, &H50, &H2B,
_
&HE, &H30, &H20, &H60, &H90, &H60, &H86, &H48, &H10, &H86, &HFC, _
&HB, &H10, &H30}


' Send routine starts here ***********************
Done = False
While Not Done
' Send a message to new UdpClient (epremote)
i += 1
udpClient.Send(sendbuffer, sendbuffer.Length,
epremote)
ListBox1.Items.Add("Packet #" & i & " sent" & " " &
sendbuffer.Length)
' Clear sendbuffer
sendbuffer.Clear(sendbuffer, 0, sendbuffer.Length)
System.Threading.Thread.Sleep(timeout)
End While
' Send routine ends here ***************************

Return ar
udpClient.Close()

Catch ex As System.Net.Sockets.SocketException
MsgBox("Exception: {0}" + ex.ToString)
End Try

End Function


 Reply:
by:spammersarevermin

 On Thu, 27 May 2004 16:36:49 GMT, spammersarevermin
<spammersarevermin@krumpli.com> wrote:

>I'm trying to put some hex values in a UDP packet & I don't have a
>clue how to accomplish this. Using the code below results in a packet
>going out w/ the right buffer length but all 00's as the data payload.
>Any help is appreciated. Sorry for the wrap.

Actually, the better question is:
How do I convert the array below to VB.NET? --

unsigned char grq[] = {
0x03, 0x20, 0x00, 0x00, 0x06, 0x00, 0x08, 0x91, 0x4a,
0x00,
0x02, 0x00, 0x0a, 0x60, 0x86, 0x48, 0x01, 0x86, 0xf8,
0x72,
0x04, 0x02, 0x01, 0x03, 0x85, 0x01, 0x40, 0x00, 0xc0,
0xa8,
0x0b, 0x16, 0xc0, 0x94, 0x02, 0x00, 0x01, 0x01, 0x80,
0x43,
0x36, 0x0c, 0x30, 0x02, 0x01, 0x10, 0x11,

0x02,
0x05, 0x2b, 0x0e, 0x03, 0x02, 0x06,
0x09, 0x60, 0x86, 0x48, 0x01, 0x86, 0xfc, 0x0b, 0x01,
0x03
};




Posted by Xander Zelders
0 Comments



Word library in server side?

Found the following interesting discussion in the Newsgroups:

Word library in server side?
by:Juan Romero

Guys,

I heard from a coleague at work that one is not able to use the Word library
in a server. He claims that Microsoft does not allow you to install this
library in a server, only workstations or personal computers.

Is this correct? and If so, is there a way to get a license from Microsoft
to use this library in a server?

Thanks!


 Reply:
by:Cor Ligthert

 Hi Juan,

I am currious, can you tell us how this is related to the language VB.Net?

Cor


 Reply:
by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP])

 
I don't have any information about licenses, but have a look at this
document:

INFO: Considerations for Server-Side Automation of Office
<URL:http://support.microsoft.com/?scid=kb;EN-US;257757>

--
Herfried K. Wagner [MVP]



Posted by Xander Zelders
0 Comments



vbFTPClient - kb article 812404

Found the following interesting discussion in the Newsgroups:

vbFTPClient - kb article 812404
by:Arne

Hi

I've downloaded the vbFTPClient mentioned in kb article 812404, but I'm not
able to run it

It seems that the problem occurs in the main function, when trying to
convert from WebRequest to FtpWebRequest,

Dim ftp As FtpWebRequest

Try

ftp = Convert.ChangeType(w, GetType(FtpWebRequest))

'the gettype won't work !!

Catch

ftp = Nothing

End Try
any advice would be nice :-)
Arne



 Reply:
by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP])

 
"Doesn't work"? Please be more specific.

--
Herfried K. Wagner [MVP]


 Reply:
by:Arne

 When I activate the sample with parms. then at this points it gives a not
handled exception. This is due to the fact that the ftp variable equals
nothing, due to the code in my snippet.

The whole suspected part of code says: when reaching ftp.passive it comes up
with an unhandled exception
I guess the problem have something to do with the GetType(FtpWebRequest)
command ??
Arne

Dim w As WebRequest = WebRequest.Create(szUri)

w.Method = szMethod

Dim ftp As FtpWebRequest

Try

ftp = Convert.ChangeType(w, GetType(FtpWebRequest))

Catch

ftp = Nothing

End Try

ftp.Passive = fPassive
If I do a gettype(ftpwebrequest) in debug (immediate window) it says :
?gettype(FtpWebRequest)

Type 'FtpWebRequest' is not defined.


 Reply:
by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP])

 
What exception? Please post the exact message.

Maybe you missed a namespace?

--
Herfried K. Wagner [MVP]


 Reply:
by:Arne

 Hi Herfried,
when it tries to access the ftp property (ftp.passive) it says that there
isn't an instance of the object (thats because the ftp variable is nothing),
so thats understandable.

I don't see how It can be anything with the namespace, as It accept the
declarence of a variable of that type
- dim ftp as ftpWebRequest

I'va digged a bit more :-)
The fptwebrequest is placed in a module and if i use the modulename in front
of the class the gettype works (thats new to me, that this is needed)

I've also implemented an errorhandler and now It says that the "Object must
implement IConvertible"

As stated earlier, it's a MS Sample I downloaded (without any changes from
my side) so It's supprisingly to me that it hasn't been tested (or could it
relate to my system ???)

Arne




Posted by Xander Zelders
0 Comments



SqlCnx.Open() no error when MSSQLServer db engine stopped

Found the following interesting discussion in the Newsgroups:

SqlCnx.Open() no error when MSSQLServer db engine stopped
by:Tom Moortgat

Hi,
My VB.Net application doesn't receive a catch error when
the MS SQL Server 2000 database engine is suddenly
stopped.
In stead the sqlcnx.Open() command results in a 'open'
state although the database is not available. The program
continues on the next line in stead of going to
the 'catch ex as SQL Exception' .

What can I do?


 Reply:
by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP])

 
.... ask in a more appropriate group:

<URL:news://news.microsoft.com/microsoft.public.dotnet.framework.adonet>

Web interface:

<URL:http://msdn.microsoft.com/newsgroups/?dg=microsoft.public.dotnet.framework.adonet>

--
Herfried K. Wagner [MVP]


 Reply:
by:Cor Ligthert

 Hi Tom,

Do you have after that SQL exception also a general exception?

....
Catch ex as SqlExecption
....
Catch ex as Exception
....
End Try

Cor



Posted by Xander Zelders
0 Comments



Putting code into GAC

Found the following interesting discussion in the Newsgroups:

Putting code into GAC
by:Derek Martin

If I put an assembly into the GAC, it should run from wherever with Full
Permissions shouldn't it?


 Reply:
by:Mattias Sjögren

 Derek,

>If I put an assembly into the GAC, it should run from wherever with Full
>Permissions shouldn't it?

Not necessarily no. It runs from the GAC, and is still subject to the
code access security policy.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.



Posted by Xander Zelders
0 Comments



Looking for Some Products

Found the following interesting discussion in the Newsgroups:

Looking for Some Products
by:Wayne Wengert

I do some volunteer work with a small non-profit that has just made the
commitment to keep all their desktop and web pages on VB and/or VB.NET.
Their existing environment includes a mix of ASP and PHP. They use SQL
Server 2000 as their DB. They need to replace a couple of capabilities
currently provided by PHP code and I am looking to pointers for products
and/or articles on how to build this type of service in .NET

1. The have a News service. An authorized user can go to a "New News
Article" page and enter a title, date, and the text of the article and click
on a "Post" button. The 6 most recent article titles and dates are listed on
their home page and clicking on a title opens the full article. Web users
can click on a "News Archive" to browse through older articles. I don't
think this would be hard to write from scratch but would like to see other
implementations.

2. A mass mailing system. Authorized users can select categories of clients
(e.g. Ticket Purchaser, Unit Representative, Sponsor, etc.) and send HTML
formatted email. They would like the ability to include CCs and BCCs.
Another option would be to have the package work through their existing
email program (mostly Outlook) where they can add CCs and such.

Any pointers appreciated.

Wayne


 Reply:
by:Cor Ligthert

 Hi Wayne,

Look on the Net with page with end with ASPX,

Than you see ASPNET working

(You can do a search on Google with it and than you see after some
develloper pages links to ASPX pages)

Cor



Posted by Xander Zelders
0 Comments



Implementing IComparable (Tuesday, December 21, 2004)

Found the following interesting discussion in the Newsgroups:

Implementing IComparable
by:Anonymous

Does anyone know if it's possible, and if so, how to implement a secondary comparison criteria?

Let's say we've got a collection of Person objects that we want sorted by LastName then by FirstName...
How would I construct a CompareTo function to accomplish this?

Thanks in advance!


 Reply:
by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP])

 
\\Dim Result As Integer = x.LastName.CompareTo(y.LastName)
If Result = 0 Then
Result = x.FirstName.CompareTo(y.FirstName)
End If
Return Result
///

--
Herfried K. Wagner [MVP]


 Reply:
by:Anonymous

 BRILLIANT! Thanks a million!



Posted by Xander Zelders
0 Comments



Known Bug - Possible Workaround??

Found the following interesting discussion in the Newsgroups:

Known Bug - Possible Workaround??
by:CJ Taylor

Alright, So this morning (as we are a week from launch on our product) I
come across an error as I add a simple thing to our system. A display
column in our dataset for databinding for display purposes only.

So everything goes smoothly, compile, start running, everything looking
good. then I go to update a row.. get a System.Data.Readonly exception.

I investigate further to find this is a known bug in the framework according
to many articles. Here is one if you want to read about it some..

http://www.error-bank.com/microsoft.public.dotnet.framework.windowsforms.databinding/_35_hcsyiv0dha.2328@tk2msftngp10.phx.gbl_Thread.aspx

So, I read the "workarounds" which are lame attempts to trick the framework
by removing expression columns from the datatable before the update, and
then add them back after the update.

Now to me... this sounds really dumb...

So I tried something. I attached to the RowUpdated and RowUpdating events
of my DataAdapter. Rowupdating provides nothing useful. However Row
Updated comes back with the Sql.Data.ReadonlyException

This sets the Status property of the
System.Data.SqlClient.SqlRowUpdatedEventArgs
to ErrorsOccured. However, I check the database and my fields were updated
as excpected. It's just the fact it can't change the Readonly property on
the expression column...

I don't care about that...

So I set the Status to continue if the error is of Data.ReadonlyException

No problems...

I return to the UI Layer... No problems... all changes updated as
expceted....

is there anything obvious I'm missing in this? Why this wouldn't work?

Comments appreciated.

Thanks,
CJ


 Reply:
by:OHM

 No problems, no problem !

OHM


 Reply:
by:CJ Taylor

 Ha! Like you this is not the answer I wanted.

Ok, then why does about 300 people agree that removing the expression
columns is the *best* way. There is no way that I figured out a better way
to do it. I'm just not that smart. =)


 Reply:
by:OHM

 I dont really have a good answer, other than if it works consistently, then
why worry about it. It's fixed in VS2005 probably anyway.

OHM


 Reply:
by:scorpion53061

 First of all good to hear from you again OHM. havent heard from you in a
while.

The challenge of overcoming the issue is the reason I will make myself
trying to fix a problem like that which CJ is dealing with.

Something like what happened to me with datatable.compute

Ask Mr.Ryan how crazy I drove him with that one!!



Posted by Xander Zelders
0 Comments



Graph in VB.Net

Found the following interesting discussion in the Newsgroups:

Graph in VB.Net
by:G. Schmelzer

Hello Newsgroup,

I'm searching for a control that draws a line in a half circle. The circle
has three sections: red, orange and green. I get values from a com device.
And the closer theese values come to the ideal value, the closer the line
gets to the green section. (Like the speedo of a car).

Knows anybody a control that can do so?? (I've been searching a lot the last
days, and found nothing...)

Thanks in Advance
G. S.


 Reply:
by:Alex Papadimoulis

 G.S.,

I'm not familiar with any control that does that. However, you can create
your own control and implement the functionality using GDI+ to draw the
circle and line.

-- Alex Papadimoulis


 Reply:
by:Marc Butenko

 In the time you spent searching, you could have built it yourself. Graphics
in .NET are easy to do, just give it a shot...

--
Marc Butenko
mbutenko@bresnan.net


 Reply:
by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP])

 
See reply in German language group ;-).

--
Herfried K. Wagner [MVP]



Posted by Xander Zelders
0 Comments



Having problems migrating an ASP .net Page to another computer

Found the following interesting discussion in the Newsgroups:

Having problems migrating an ASP .net Page to another computer
by:Anonymous

Dear folks,
After completing my ASP .net application, I had to transfer it to my server PC running 'windows server 2003'. I just copied all the file from my folder and then copied it to the shared folder in that server computer, but nothing worked! Does the server computer require VB .net ? It doesn't recognize any of the file extensions at this point. So basically I need to know , what are all the requirements that a computer should have inorder for ASP .net pages to run. Any pointers would be appreciated.
cheers,

Ranjan


 Reply:
by:Patrick Steele [MVP]

 In article <74800A90-12E5-4C72-A47A-7CFE2E051505@microsoft.com>,
anonymous@discussions.microsoft.com says...
> So basically I need to know , what are all the requirements that a
> computer should have inorder for ASP .net pages to run.

First, IIS must be installed and then, at lest, the .NET runtime. You
can put the full SDK on if you think at some point you may want to do
some debugging, but only the runtime is needed.

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele



Posted by Xander Zelders
0 Comments



VB.NET 2003 Standard Classes & DLL Creation

Found the following interesting discussion in the Newsgroups:

VB.NET 2003 Standard Classes & DLL Creation
by:Paul Woodward

Can the standard edition of VB.NET 2003 create DLL's? I have purchased the
standard edition while I re-teach myself the VB language but I am struggling
to create references to a class which is in the same Solution but in a
different Project because it complains that the Class is not a DLL.

Any idea's if it is because I have the standard edition or I am doing
something wrong?

Here is the exact error message: -

====
A reference to 'Class Name' could not be added. An assembly must have a
'dll' extension in order to be referenced.
====

Kind Regards,

Paul Woodward


 Reply:
by:Alex Papadimoulis

 Paul,

To create a DLL, select ClassLibrary as the project type on a new project
wizard. You will then need to Add a Reference to your classlibrary from your
existing project.

-- Alex Papadimoulis


 Reply:
by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP])

 * "Paul Woodward" <nospam@myinbox.com> scripsit:
> Can the standard edition of VB.NET 2003 create DLL's?

No.

"Workarounds":

Open the ".vbproj" file in notepad and change the 'outputtype' to 'library'.

Alternatively, you can use this add-in for Visual Basic .NET Standard:

<URL:http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=517>

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>


 Reply:
by:Paul Woodward

 Cheers Guys,

Your help is very much appreciated...

Regards,

Paul Woodward



Posted by Xander Zelders
0 Comments



String concatenating for Dataset.compute method

Found the following interesting discussion in the Newsgroups:

String concatenating for Dataset.compute method
by:Anonymous

I am trying to use the compute method on a dataset that uses a concatenated string as the filter. Here is my code:

Dim myTable As DataTable
myTable = CheckHrsVacDataSet1.Tables("PYCheckHistory")
Dim str1 As String = "((Employee = '"
Dim str2 As String = "') AND (CheckDate >= '"
Dim str3 As String = "'))"
VacHrsThisYr.Text = myTable.Compute("Sum(TotalVacationHrs)", (String.Concat(str1, EmployeeID, str2, fiscalYrDate, str3))).ToString

The code works fine but I get an error when my str1 picks up employees with an apostrophe in their name (ie: O'neal). The compute method thinks that the O' is the end of the string. Does anyone know how I can code around this?

Thanks



 Reply:
by:Jay B. Harlow [MVP - Outlook]

 JC,
You need to "quote" the quoted string.

The easiest way is to use String.Replace, something like:

VacHrsThisYr.Text = myTable.Compute("Sum(TotalVacationHrs)",
String.Concat(str1, EmployeeID.Replace("'", "''"), str2, fiscalYrDate,
str3))

Note String.Concat & String.Replace return strings, there is no need to call
ToString on the return value.

Hope this helps
Jay


 Reply:
by:Anonymous

 thanks jay, u got it


 Reply:
by:mwazir

 Have you tried replacing one apostrophe with two?

EmployeeID = EmployeeID.Replace(Chr(39), Chr(39) & Chr(39))
VacHrsThisYr.Text = myTable.Compute("Sum(TotalVacationHrs)",
(String.Concat(str1, EmployeeID, str2, fiscalYrDate, str3))).ToString

HTH

--
Wazir



Posted by Xander Zelders
0 Comments



Any VB/COM experts here??

Found the following interesting discussion in the Newsgroups:

Any VB/COM experts here??
by: SamSpade

Applications can retrieve an ITextDocument pointer from a rich edit control.
To do this, send an EM_GETOLEINTERFACE message to retrieve an IRichEditOle
object. Then, call the object's QueryInterface method to retrieve an
ITextDocument pointer.

How to do that?? I tried:

Dim oREO As Object

Dim mIDocument As tom.ITextDocument

SendMessage(Handle, EM_GETOLEINTERFACE, 0, oREO)

mIDocument = CType(oREO, tom.ITextDocument)

But this produces a "Cast Not Valid" message

Anyone have any insight as to how to make VB call QueryInterface??

Thanks in advance


 Reply:
by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP])

 
Untested in your situation:
'System.Runtime.InteropServices.Marshal.QueryInterface'.

--
Herfried K. Wagner [MVP]


 Reply:
by: SamSpade

 I had read this but did not understand how to use it.

Thanks


 Reply:
by: SamSpade

 Maybe I've got it



Posted by Xander Zelders
0 Comments



The specified domain either does not exist or could not be contacted

Found the following interesting discussion in the Newsgroups:

The specified domain either does not exist or could not be contacted
by:Anonymous

I am new to .NET (and directory services) and I need to fill a drop down list box with the users of my company. I am trying to use the code shown below, but I get this error message when the line of code with the "For" statement runs: "System.Runtime.InteropServices.COMException: The specified domain either does not exist or could not be contacted"
Can anyone give me any ideas as how to resolve this? Any and all help would be greatly appreciated. Thanks.


Dim DirSearch As New DirectorySearcher(userDSE)
DirSearch.SearchScope = SearchScope.Subtree
DirSearch.PropertiesToLoad.Add("name")
DirSearch.PropertiesToLoad.Add("mail")
DirSearch.Filter = "(objectcategory=user)"
For Each sr As SearchResult In DirSearch.FindAll <-- ERROR OCCURS HERE
Dim li As New ListItem
li.Text = sr.Properties("Name")(0)
li.Value = sr.Properties("Name")(0)
ddlReporter.Items.Add(li)
Next







 Reply:
by:Gerry

 Rick,
If you receive an answer to this directly, please post back to the list. I
have been trying to resolve this very issue for some time now.


 Reply:
by:Joe Kaplan \(MVP - ADSI\)

 You didn't specify where this code is running and your code doesn't show
where userDSE comes from. Since that is the object that is going to
determine the security context and LDAP server, that is the important part.

Is this running under ASP.NET? If so, these articles will help you:
http://support.microsoft.com/default.aspx?scid=kb;en-us;329986
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sds/sds/troubleshooting_authentication_problems_on_asp_pages.asp?frame=true

Also, I recommend you follow up in microsoft.public.adsi.general as that is
where the great majority of S.DS questions get fielded around here.

HTH,

Joe K.



Posted by Xander Zelders
1 Comments



Measuring an angle

Found the following interesting discussion in the Newsgroups:

Measuring an angle
by:Lasse Eskildsen

Hi,
I'm trying to measure an angle of a triangle in vb.net, but I'm not getting
it right.

This is my triangle (kind of):

A
l1 1 l - - - -
C B

I know the lengt of all 3 sides, and angle C is always 90 dregrees.
I've been working with the Tan() function from System.Math, but I can't make
it work :o(

Any help would be greatly appreciated!

--
Lasse


 Reply:
by:CJ Taylor

 perhaps this will help.

http://www.themathpage.com/aTrig/trigonometry-of-right-triangles.htm


 Reply:
by:Jay B. Harlow [MVP - Outlook]

 Lasse,
Quiz for you: How many radians are in a Degree?

Remember the Math.Tan function works with Radians not degrees.

Hope this helps
Jay

P.S. for the answer to the quiz look up Math.Tan in the on-line help.


 Reply:
by:OHM

  As well as the others Remember this

Sin = Opposite/Hypotenuse
Cos = Adjacent/Hypotenuse
Tan = Opposite/Adjacent



Posted by Xander Zelders
0 Comments



Unable to upgrade VB6 COM Dll to VB.Net

Found the following interesting discussion in the Newsgroups:

Unable to upgrade VB6 COM Dll to VB.Net
by:Shailja

I read lots of stuff on MSDN relating to upgrading a COM
Dll build using VB6 to VB.Net. Its seems to be a very easy
task. As per few articles when we open vb6 application
in .Net framework upgrade wizard is invoked. The wizard
gives us option to create DLL (option to create EXE is
grayed). Then articles says that if we want methods of
public classes to be converted to interface methods check
the box for Generate Interfaces For Classes. Now at my end
this checkbox does not appear on Page 2 of the wizard. I
have got version 7.1. The result is that my application is
upgraded successfully but the upgrade HTML displays
GenerateInterfacesForClasses = FALSE. Moreover when i try
to create a TLB using a utility i only get methods of
IDispatch Interface. TLB does not have my interface
methods , although it do create entry for my interface.
Please through some light on this problem.
Thanks in advance,
Shailja


 Reply:
by:Ken Tucker [MVP]

 Hi,

Set the comvisible attribute for the class.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemruntimeinteropservicescomvisibleattributeclasstopic.asp

Use regasm.exe to register the class
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cptools/html/cpgrfassemblyregistrationtoolregasmexe.asp

Ken


 Reply:
by:Shailja

 
Thanks Ken, your tip did helped me to solve the problem.

Regards,
Shailja



Posted by Xander Zelders
0 Comments



TypeConverter.CreateInstance-Method

Found the following interesting discussion in the Newsgroups:

TypeConverter.CreateInstance-Method
by:Oskar Vaia

Hi,

in the .NET Framework Class Library there is the following text in the
"Remarks"-section:

"Use this method for objects that are immutable, but for which you want to
provide changeable properties."

.... objects that are immutable ... - what does this mean? Can someone please
insert here an example?

thx & bye

Oskar


 Reply:
by:Sven Groot

 
An immutable object is an object who's internal state cannot change after it
has been created. Strings are an example of immutable objects in the .Net
Framework. You can never change the value of an existing String object,
since all its methods return a new String object, leaving the original
object intact.

--
Sven Groot

http://unforgiven.bloghorn.com



 Reply:
by:Cor Ligthert

 Hi Oskar,

A String is immutable, a change will mean that it is written on a new place
and the old one is destroyed when the Garbadge Collecter does his work.

I hope this clears it a little bit?

Cor


 Reply:
by:Oskar Vaia

 hi,

thx for your answers.
ok, but what does it so mean in the context with the
Typeconverter.CreateInstance-Method?

bye

Oskar



Posted by Xander Zelders
0 Comments



vb.net & word

Found the following interesting discussion in the Newsgroups:

vb.net & word
by:msdn

hi

it is possible to open word document in RichTextBox(textarea) ?

but i don't want to install MsWord, i want only open document, inesert some
text and save it.

do you know how to do this ?
thx



 Reply:
by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP])

 * "msdn" <qbg.arg@jc.cy> scripsit:
> it is possible to open word document in RichTextBox(textarea) ?

No, if it's not saved in RTF format.

> but i don't want to install MsWord, i want only open document, inesert some
> text and save it.

That's basically not possible, except if the document ist stored in Word
2003's WordML. Then you can use .NET's XML classes to modify the
document.

--
Herfried K. Wagner [MVP]



Posted by Xander Zelders
0 Comments



How to let GUI application write output to commandline?

Found the following interesting discussion in the Newsgroups:

How to let GUI application write output to commandline?
by:Rvo

I'm writing an application that should work both as a GUI and a commandline
program.
When running from commandline I want to give all output to the commandline
instead of showing it it an own interface.
When I use Console.writeline the output doesn't appear at the commandline
prompt though.
I guess this is because the default output for the Console.Writeline is set
to the (invisible) gui at that time.

Is there a way to avoid/change this behaviour?

Thanks for your time...

Romain


 Reply:
by:AlexS

 Hi, Rvo

You have to detect if program is started in GUI or console mode and act
accordingly. If you want to duplicate output to console always, you might
want to consider
- creating your application as console one
- attach console to process otherwise using Win32 APIs like AttachConsole or
GetConsoleWindow. Depends how exactly you need console to behave

You might want to check Platform SDK help - Console Functions - to find more
details.

HTH
Alex



Posted by Xander Zelders
0 Comments



Copy object with .Net?

Found the following interesting discussion in the Newsgroups:

Copy object with .Net?
by:Grahammer

In VB6 I had to create "Clone" method if I wanted to generate an independant
copy of an object.

In VB.Net, is it possible copy an object so that you can change the copy
without altering the original, or do I still need to use a self created
Clone method?

Thanks!


 Reply:
by:Alex Papadimoulis

 Grahammer,

To create a shallow copy of your object (i.e. just value fields, but
references to other objects will be the same), use the MemberwiseClone
(built into objects) function. Example:
myNewObject = DirectCast(myObject.MemberwiseClone, myType)

However, if you want deep copy your object, you will need to have your class
implement the IClonable interface.

-- Alex Papadimoulis



Posted by Xander Zelders
0 Comments



Find the cursor position in a textbox

Found the following interesting discussion in the Newsgroups:

Find the cursor position in a textbox
by:Neil Robbins

Could anyone suggest a way in which I could find the position of the cursor
within a textbox.

I want to evaluate every keypress made within the textbox in order to
validate it but in order to do this I need to know where the cursor is when
the key is pressed. So far I can't see how I could do this.

Any help would be very much appreciated,

Neil R.


 Reply:
by:Ken Tucker [MVP]

 Hi,

TextBox1.MousePosition

Ken


 Reply:
by:Neil Robbins

 Hi Ken,

Thanks for the response, unfortunately I think that perhaps I should have
been a little more specific.

I need to to know the location of the text cursor, not the mouse cursor. So
if there are 10 characters allowed in the textbox and the user has entered a
string of 6 characters but has gone back to edit the third character I need
to know that it is the third character that is being edited and not the
second (or any other) character.

I hope that this clarifies things a little.

Any further help would be greatly appreciated.

Neil R.


 Reply:
by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP])

 
The text cursor is called caret.
Maybe you are looking for the control's 'SelectionStart' property?

--
Herfried K. Wagner [MVP]


 Reply:
by:Neil Robbins

 Thanks Herfried thats just what I was looking for.

Neil R.



Posted by Xander Zelders
0 Comments



Extracting Image Metadata

Found the following interesting discussion in the Newsgroups:

Extracting Image Metadata
by:BluDog

Hi

Does anyone know how to extract Jpg image metadata from an image?

Cheers

Blu


 Reply:
by:Cor Ligthert

 Hi Bludog,

Here some links
http://www.bobpowell.net/faqmain.htm
http://www.vb-helper.com/index_vbnet.html#graphics

I hope this helps a little bit?

Cor


 Reply:
by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP])

 
Photo Properties
<URL:http://www.codeproject.com/cs/media/photoproperties.asp>

--
Herfried K. Wagner [MVP]



Posted by Xander Zelders
0 Comments



NTFS Folder Permissions

Found the following interesting discussion in the Newsgroups:

NTFS Folder Permissions
by:Joey

Hey,
How can I add/edit/delete Folder NTFS permissions in .NET?
I have a Win2K Box, and WMI is not installed on my servers
Thanks ahead!

-- Joey


 Reply:
by:Arne Janning

 
Hi Joey,

HOW TO: Programmatically Set NTFS File System Folder Permissions by
Using Microsoft Visual Basic .NET

http://support.microsoft.com/?scid=818362

Cheers

Arne Janning


 Reply:
by:Joey

 Hey Arne, Thanks for replying!
I'v seen this code, but it doesnt compile - all the const-like parameters
there (in example: ADS_SID_SDDL) are undefined...
If you could edit that code and give me a working sample that'd be greate!
Thanks ahead,

--Joey


 Reply:
by:Arne Janning

 
Hi Joey,

I looked over the code of the MS-HowTo and I think that there are better
and more .NET-like ways to do this:

http://www.codeproject.com/dotnet/NTSecurityNET.asp

http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=e6098575-dda0-48b8-9abf-e0705af065d9

Cheers

Arne Janning



Posted by Xander Zelders
0 Comments



To suspend the events

Found the following interesting discussion in the Newsgroups:

To suspend the events
by:Stefano

There's a metod to suspend event's form(or control in general) raising?



 Reply:
by:Cor Ligthert

 Hi Stefano,

A lot, setting a switch and for that you can look to the
static myswitch as boolean
Which you can use inside a procedure while it stays static (will not be
garbagded)

Or you can use the
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcn7/html/vaconwritingeventhandlers.asp

See the part Using Remove hanlder ............

I hope this helps?

Cor


 Reply:
by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP])

 * "Stefano" <stefano1856*no*spam@libero.it> scripsit:
> There's a metod to suspend event's form(or control in general) raising?

Disable the form.

--
Herfried K. Wagner [MVP]


 Reply:
by:Stefano

 With this I've tried but the events there're yet



Posted by Xander Zelders
0 Comments



Get network status through WMI

Found the following interesting discussion in the Newsgroups:

Get network status through WMI
by:Norton

Hi all,

May i know how to get the network status through WMI, i have searched the
WMI properties but cannot find the related property to use.
thx in advance

Norton


 Reply:
by:Ken Tucker [MVP]

 Hi,

If you are looking to check network status for an active network
connection. You need to a reference to system.management.dll for this to
work.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_networkconnection.asp

Private Sub GetNetworkStatus()
Dim moReturn As Management.ManagementObjectCollection
Dim moSearch As Management.ManagementObjectSearcher
Dim mo As Management.ManagementObject

moSearch = New Management.ManagementObjectSearcher("Select * from
Win32_NetworkConnection")

moReturn = moSearch.Get
For Each mo In moReturn
Dim strOut As String
strOut = String.Format("{0} - Status {1}", mo("Name").ToString,
mo("Status").ToString)
Trace.WriteLine(strOut)
Next
End Sub

Here is a link to see if you are connected to a network that uses a
ping

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/northwindunplugged.asp

Ken


 Reply:
by:norton

 thx a lot ~ it works ~



Posted by Xander Zelders
0 Comments



Big red cross in DataGrid.. ?

Found the following interesting discussion in the Newsgroups:

Big red cross in DataGrid.. ?
by:Lars Netzel

What's that? I guess something has gone wrong then but what? The Application
hangs when it happens and I haven't been able to find out When it happens,
it just does sometimes when I click a lot..

What does it mean?

/Lars Netzel


 Reply:
by:Ken Tucker [MVP]

 Hi,

It is a bug with the datagrid.

Ken


 Reply:
by:Lars Netzel

 Bug? How do I work around it? When does it happen?

/Lars


 Reply:
by:Ken Tucker [MVP]

 http://www.dotnet247.com/247reference/msgs/41/209539.aspx

Ken



Posted by Xander Zelders
2 Comments



Check Windows Services are still running OK

Found the following interesting discussion in the Newsgroups:

Check Windows Services are still running OK
by:Anonymous

I don't know if this is the correct newsgroup but I couldn't find one for Windows Services.

Is it possible to check that a Windows Service is still running from another machine?

The idea being a couple of machines will be running my Windows Services to handle certain parts of our application, these machines will be located in the server room. I would like to create an application that runs on one of the users PC's that checks that these services are still running and haven't had any errors. Is it possible?

Thanks in advance.
Chris Podmore.


 Reply:
by:v-phuang@online.microsoft.com (Peter Huang)

 Hi Chris,

I think we can use the WMI to do the stuff.
In the .net framework we can use the classes under the system.management
namespace which is a .net wrap of wmi.

Here is code going.
Imports System.Management
Module Module1
Sub Main()
'replace the computername according to your senario.
Dim mc As New
System.Management.ManagementClass("\\computername\root\cimv2",
"Win32_Service", New ObjectGetOptions)
For Each o As ManagementObject In mc.GetInstances()
Console.WriteLine(o.GetPropertyValue("Name"))
Console.WriteLine(o.GetPropertyValue("State"))
Next
End Sub
End Module

Here is the properties we can get in the Win32_Service.
Win32_Service
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/
win32_service.asp

You may also take a look at the link below.
Take Charge with Windows Management Instrumentation
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnasdj00/ht
ml/asp00a1.asp

Monitoring and Dynamically Configuring Windows Services
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/ht
ml/config_winservices.asp


Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Is it possible to check that a Windows Service is still running from
another machine?

The idea being a couple of machines will be running my Windows Services to
handle certain parts of our application, these machines will be located in
the server room. I would like to create an application that runs on one of
the users PC's that checks that these services are still running and
haven't had any errors. Is it possible?

Thanks in advance.
Chris Podmore.
>



 Reply:
by:Anonymous

 Peter,

Thanks for the reply and links, they appear to be just what I am looking for. At least they will point me in the right direction.

Chris.



Posted by Xander Zelders
0 Comments



Monitor mouse events in application

Found the following interesting discussion in the Newsgroups:

Monitor mouse events in application
by:Anonymous

I need to monitor the status of the mouse on an application-wide basis (i.e., not just for the control that owns the mouse). One I idea I had was to create a shared class that inherits from timer and tests Windows.Forms.Control.MouseButtons and Windows.Forms.Cursor.Current.Position in the tick event. Obviously this technique is not perfect because I am relying on the tick event. Also, I've discovered that Windows.Forms.Control.MouseButtons does not update immediately when the user clicks the title area of a form (i.e., when the form's Text, Icon, and ControlBox are displayed). Is there a better technique?

Thank you,
Lance


 Reply:
by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP])

 
A mouse hook ('WM_MOUSE' or similar) would be a more reliable way:

Article on keyboard hooks (can be adapted for mouse hooks):

<URL:http://www.developer.com/net/net/article.php/11087_2193301_1/>

Documentation on hooks:

<URL:http://msdn.microsoft.com/library/en-us/dnwui/html/msdn_hooks32.asp>
<URL:http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/windowing/hooks.asp>

--
Herfried K. Wagner [MVP]


 Reply:
by:Anonymous

 Great. Thanks.



Posted by Xander Zelders
0 Comments



Project deploy

Found the following interesting discussion in the Newsgroups:

project deploy
by:\Allen Iverson\

Can you please advise me how to setup and deploy a donet project? How to add
..net framework to client station? Thanks.


 Reply:
by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP])

 
Using Visual Studio .NET 2003 to Redistribute the .NET Framework
<URL:http://msdn.microsoft.com/library/en-us/dnnetdep/html/vsredistdeploy1_1.asp>

Plug-In:

<URL:http://groups.google.com/groups?selm=z2an4EnoDHA.2012%40cpmsftngxa06.phx.gbl>

Bootstrapper:

<URL:http://msdn.microsoft.com/vstudio/downloads/tools/bootstrapper/>

Microsoft Visual Studio .NET 2003 Bootstrapper Plug-In
<URL:http://www.microsoft.com/downloads/details.aspx?FamilyID=627921a0-d9e7-43d6-a293-72f9c370bd19>

<URL:http://workspaces.gotdotnet.com/vsboot/> (old URL)

Download
<URL:http://www.gotdotnet.com/community/workspaces/newsitem.aspx?id=2f8f0a23-f529-4158-8e0a-d187d16f41f1&newsId=1981>

Framework 1.1:

Redistributing the .NET Framework 1.1
<URL:http://msdn.microsoft.com/library/en-us/dnnetdep/html/redistdeploy1_1.asp>

..NET Framework 1.1 Deployment Guide
<URL:http://msdn.microsoft.com/library/en-us/dnnetdep/html/dotnetframedepguid1_1.asp>

..NET Framework 1.1 Redistributable Prerequisites
<URL:http://msdn.microsoft.com/library/en-us/dnnetdep/html/NETFx1Redistreq1_1.asp>

..NET Framework Redistributable Package 1.1 Technical Reference
<URL:http://msdn.microsoft.com/library/en-us/dnnetdep/html/dotnetfxref1_1.asp>

Framework 1.0:

..NET Framework Deployment Guide
<URL:http://msdn.microsoft.com/library/en-us/dnnetdep/html/dotnetframedepguid.asp>

Using Visual Studio .NET to Redistribute the .NET Framework
<URL:http://msdn.microsoft.com/library/en-us/dnnetdep/html/vsredistdeploy.asp>

--
Herfried K. Wagner [MVP]



Posted by Xander Zelders
0 Comments



Pull Non-VB.net program into focus and send keys.

Found the following interesting discussion in the Newsgroups:

Pull Non-VB.net program into focus and send keys.
by:peter@mclinn.com (Peter)

I'm looking to write a program that pulls an application into focus,
and then sendskeys to it. Anyone have a link to a tutorial?


 Reply:
by:Cor Ligthert

 Hi Peter,

You can look here to a message from Pieter, maybe can help you.
(I do not know if it does)

http://groups.google.com/groups?selm=eDRJNMWQEHA.1892%40TK2MSFTNGP09.phx.gbl

(I do not know if that German part is from Herfried)

I hope this helps?

Cor


 Reply:
by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP])

 
It actually is, the whole code should work...

--
Herfried K. Wagner [MVP]


 Reply:
by:Cor Ligthert

 
I wrote that because I was sure that when it was you would answer.

I will tell that next time.

Cor



Posted by Xander Zelders
0 Comments



VERY weird variable behavior

Found the following interesting discussion in the Newsgroups:

VERY weird variable behavior
by:petdoc

Hi Folks,

I am trying to find the most perplexing bug I have had in a vb.net app to
date.

Here is some code:

Dim Data as Short

Data = Me.ReadPMAPDigits(pmOffsets.APIAS)
Trace.WriteLineIf(blnErrorLogging, Now.ToString & ": Raw IAS: " &
Data.ToString, "Data")

'Mask off everything but lowest 10 bits - we only need values below 511 and
no negative values
Data = Data And CShort(&H3FF)
Trace.WriteLineIf(blnErrorLogging, Now.ToString & ": IAS: " &
Data.ToString, "Masked Data")

'Trap outliers
If Data > CShort(511) Then
Trace.WriteLineIf(blnErrorLogging, Now.ToString & ": E-IAS: " &
Data.ToString, "Error")
Me.GlobalErrorCount += 1
Exit Function
End If

The function this code comes from resides in a "super loop" (called via
nonthreaded delegate invocation every 60ms), reads airspeed from a flight
simulator (via interprocess communication) and returns a short value that
typically is in the range of 0-400 and for the following data was fixed at
120. Here is a snippet of logged data that repeated for about 5 minutes:

Data: 5/26/2004 10:16:16 PM: Raw IAS: 120
Masked Data: 5/26/2004 10:16:16 PM: IAS: 120
Data: 5/26/2004 10:16:16 PM: Raw IAS: 120
Masked Data: 5/26/2004 10:16:16 PM: IAS: 120
Data: 5/26/2004 10:16:16 PM: Raw IAS: 120
Masked Data: 5/26/2004 10:16:16 PM: IAS: 120

So far so good. But then...

Data: 5/26/2004 10:03:13 PM: Raw IAS: 120
Masked Data: 5/26/2004 10:03:13 PM: IAS: 120
Error: 5/26/2004 10:03:13 PM: IAS: 131072
Data: 5/26/2004 10:03:13 PM: Raw IAS: 120
Masked Data: 5/26/2004 10:03:13 PM: IAS: 120
Error: 5/26/2004 10:03:13 PM: IAS: 131072

Now can somebody tell me 1) How can the variable "Data" change from the 2nd
Trace.writeline to the third Trace.writeline (all I did was compare it to a
constant in between) *and* 2)How it got stuffed with decimal 131,072 - a
value too large to be represented by a short???? How might I stop this?

Help! I'm losing my mind over this and even with error trapping it's
ruining my program.

Scott




 Reply:
by:petdoc

 Turns out I *had* solved the bug - in THIS function. Unfortunately a
similar function that checked a different source for airspeed *also* had an
error trace identical to the one in question - and it was *that* function
that was generating the "ghost" error.

<blush> Sorry!

Scott



Posted by Xander Zelders
0 Comments



How can i return a icon image of a file through openfiledialog?

Found the following interesting discussion in the Newsgroups:

how can i return a icon image of a file through openfiledialog?
by:jack xu

just like outlook when you insert a attachment ,a icon image of the file you
selected will show in a textbox.

Thanks.


 Reply:
by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP])

 
<URL:http://vbaccelerator.com/article.asp?id=4302>
<URL:http://vbaccelerator.com/article.asp?id=4567>

--
Herfried K. Wagner [MVP]



Posted by Xander Zelders
1 Comments



non-shared member of a class

Found the following interesting discussion in the Newsgroups:

non-shared member of a class
by:Mike Johnson

I got the error below, can someone provide the answer in code to the problem
listed below. Thanks.

You have tried to reference a non-shared member of a class from within a
shared method or shared method initialize. The following code provides an
example of such a situation:

Class Sample
Public x as Integer 'An instance member
Public Shared Sub Bar()
x = 10 'Produces the error
End Sub
End ClassThe shared method does not actually operate on any one instance of
the class. Instead, each instance has its own copy of x, which causes the
error.

To correct this error

a.. Provide an explicit instance of the class whose member you wish to
reference. In the example above, provide an explicit instance of the class
containing the copy of x which you wish to set equal to 10.
I can't use shared to fix the problem so please explain in code how to do
the above. Thanks


 Reply:
by:Anonymous

 It's kind of funny, when you think about it.

You started your post with the ruse that this was an error you encountered while writing code. You then posted a question verbatim out of a text book.

What's worse, the question has already been answered in your own post. Simply follow the instructions under the line "To correct this error".



Posted by Xander Zelders
1 Comments



Visual Studio Hangs when New Project invoked

Found the following interesting discussion in the Newsgroups:

Visual Studio Hangs when New Project invoked
by:Anonymous

I've reinstalled twice now... I've got the Visual Studio.net Academic version 2003. During installation, I get no errors but when I try to open a new project from the inital start page, it just hangs and then eventually the application stops responding. I'm running on Windows XP Professional, I've made sure IIS is activated.

Any Ideas?


 Reply:
by:cyn_lau@online_microsoft.com (Cynthia Lau[MSFT])

 You might not have enough memory on the drive.
Please check the requirement on the box of your VS .NET Academic version
2003 and the free space of the drive that you have the product installed.

Thanks,
Cynthia
DDSE QA

Any Ideas?
>




Posted by Xander Zelders
0 Comments



Expandable Menus

Found the following interesting discussion in the Newsgroups:

Expandable Menus
by:T Perkins

Just curious, does anyone know how to make the menus that have the arrows on
the bottome to expand the view. i would like to hide some of the lesser used
menu items on an app.

thanks
tony


 Reply:
by:Sven Groot

 T Perkins wrote:
> Just curious, does anyone know how to make the menus that have the
> arrows on the bottome to expand the view. i would like to hide some
> of the lesser used menu items on an app.

You write them yourself from scratch. Those menus are not a standard part of
Windows or .Net. Maybe you can find controls on the web that can do it.

--
Sven Groot

http://unforgiven.bloghorn.com




Posted by Xander Zelders
0 Comments



Having problems using the GetProcesses from a remote computer

Found the following interesting discussion in the Newsgroups:

Having problems using the GetProcesses from a remote computer
by:Steve D

I am writing a program that monitors processes on remote computers. I am
using Process.GetProcesses(remotecomputername), and it works for some of
the computers on the network, but not all of them. Some of the computers
give me an Access Denied error. It says that it couldn't get the
processes from the remote computer. If anyone could help me fix this, it
would greatly appreciated.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


 Reply:
by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP])

 
Post the complete exception you get.

--
Herfried K. Wagner [MVP]


 Reply:
by:Bismark Prods

 Hi,

Has the account used to run your application, the same rights (network
rights) on all computers ?

Bismark


 Reply:
by:Steve D

 I using the administrator account, which is used on all the network
computers, which I assume would have the same network rights.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


 Reply:
by:Bismark Prods

 Not necessary ! Be warn that you admin account had each time a reserved
account on the remote computer and have enough rights ! In Win2000 it is a
little bit complicate to !

Bismark



Posted by Xander Zelders
0 Comments



CheckedListBox

Found the following interesting discussion in the Newsgroups:

CheckedListBox
by:justjump@yahoo-dot-com.no-spam.invalid (JJump)

lbDeletePeople.DataSource = ds.Tables(0)
lbDeletePeople.DisplayMember = "Name"
lbDeletePeople.ValueMember = "GeneralTrialInfoID"

So the Name that I got from my dataset comes in fine. I have no clue
what ValueMember gets.. but that is a field in the dataset. How do I
know that is what is going in there? And how in the world do I pull
out that ID?????
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com


 Reply:
by:justjump@yahoo-dot-com.no-spam.invalid (JJump)

 For Each itemChecked In lbDeletePeople.CheckedItems
DeletePerson(lbDeletePeople.SelectedValue)
Next

the deleteperson command gives me the same value every time (the first
item in the list checked). How do I make it give me the value of the
NEXT item in the list???
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com



Posted by Xander Zelders
0 Comments



Datagrid delete problem

Found the following interesting discussion in the Newsgroups:

datagrid delete problem
by:Anonymous

Hi, I have a problem using the Datagrid control in Vb.Net. I have a datagrid which I programatically bind to a table from a db. In other words, I create a data table from a data adapter.fill, and then set the data source for the dbgrid to the table. Yada yada.

So, this all works fine. It even does some nice things for me. For example, some columns don't allow nulls. In the datagrid, if I select the text in such a column, delete it, and then click on another row, the app automatcially pops up a dialog box which says: "Column 'mycolumn' does not allow null. Do you want to correct the value?" And you can then say yes or no to fix it.

The problem comes when you delete a row after you deleted the text of a non-nullable column. Specifically, do this:
1 - select and delete the text in a column that does not allow nulls
2 - immediatly then click on the row header, which selects the row
3 - hit the delete key

At this point, your app dies with an unhandled exception "Column 'mycolumn' does not allow nulls". So, even though the app is smart enough to warn you when you click on another row if you have null in a non-nullable column, it isnt' smart enough to warn you when you click on the row header to perform a delete.

So, my question is how would you deal with this or catch this exception. There doesn't seem to be a DataGrid.DeleteRow event to catch, and the DataTable.DeleteRow doesn't get fired. Also, I tried catching the DataGrid.RowHeaderSelected event to test the value of the non-nullable column, but at the point of this event the value returned from referencing that cell is still the old value before you deleted it. So I can't test it for null because it's not null yet.

Anyway, if I could catch the datagrid deleterow event and test this value to see if it was null and then terminate the delete row process, that in a nut shell is what I'm trying to do. Or any cheat way to achieve this.

Thanks for any info anyone may have on this wierd problem.

Tony



 Reply:
by:Ken Tucker [MVP]

 Hi,

The datacolumn has an allowdbnull property
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdatadatacolumnclassallowdbnulltopic.asp

Sample code for a datagrid that pops a confirmation box when you delete a
row and raises an event when a row is delete.
http://www.onteorasoftware.com/downloads/delete.zip

Ken


 Reply:
by:Anonymous

 Ken,

Thanks. The sample code for the ConfirmDeleteDataGrid is interesting and I think I could use this to make it work.

I knew about the Column's AllowDbNull property, but that doesn't work. As I said in the email, from the da.fill it already set this property to false (just to be sure I set the property explicitly to false however), and that's why when I delete the value and then click on another row, it pops up telling me that it can't be null. However, if you delete the value and then click on the Row Header, it doesn't check it yet, thereby giving the user the chance to hit delete before it forces you to fix it.

Anyway, I figured out a way to do it. I'm catching the ColumnChanging event for the data table. If the change is for the column I want, I test the proposed value and if it's dbnull, then I pop a message, change the proposed value back to the old value, and change focus to that cell. Unlike just relying on the columns AllowDbNull property, which doesn't come into play when moving from the cell to the Row Header, by catching and using the ColumnChanging event I'm able to stop it before the user can click on the Row Header and perform the delete.

Thanks for your suggestions, and I may end up doing somthing more like what you sent in the sample code.

Tony




Posted by Xander Zelders
0 Comments



Distributed application programming

Found the following interesting discussion in the Newsgroups:

Distributed application programming
by:Tim Marsden

I am new to distributed application programming. Could anybody give me
advice on how to accomplish the following? I am writing in VB.NET. I would
like to keep away from web services and IIS if possible. Perhaps using some
form of remoting.

I would like to develop an application which sits on a "server". (or a Pc
which sits in the corner)

This application would take requests from a "client" application; the client
app will sit on numerous PCs.

The server app would then process the request and pass the result back to
the client app.

The process taking place on the server could be lengthy, so I would like to
be able to run multiple requests at once (different threads). I would like
to set a maximum number of concurrent processes, the other requests would
queue up on a first come first served basis, waiting for a free thread.

I would like a graphical representation of which requests are being
processed and which are in the queue.

Please respond with any thoughts. Every response is appreciated.

Regards

Tim Marsden




 Reply:
by:v-phuang@online.microsoft.com (Peter Huang)

 Hi Tim,

Now I am researching the issue, I will get back here and update you with
new information ASAP.
Have a nice day!

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.



 Reply:
by:v-phuang@online.microsoft.com (Peter Huang)

 Hi Tim,

Based on my research, the .net remoting will do many of the thread schedule
itself, if you do not care it, I think remoting will help you save much
time, what you have to do is build a server and client application, all the
client will try to post request to the server and then the server process
the request, if there is any error, the client will try to repost the
request.
For your senario, if you do want to control whole procedure, I think you
would better handle the threads yourself so as to guarantee the performance
and flexibility.

When to Handle Threads Yourself
Using the thread pool effectively is closely linked with knowing what you
need from your threads. If you need a guarantee of service, you'll need to
manage it yourself. For most cases, using the pool will provide you with
the optimal performance. If you have hard restrictions and need tight
control of your threads, it probably makes more sense to use native threads
anyway, so be wary about handling managed threads yourself. If you do
decide to write managed code and handle the threading on your own, make
sure that you don't spawn threads on a per-connection basis: this will only
hurt performance. As a rule of thumb, you should only choose to handle
threads yourself in the managed world in very specific scenarios where
there is a large, time-consuming task that is done rarely. One example
might be filling a large cache in the background, or writing out a large
file to disk.

I would just recommend to use and tune the thread pool provided by the clr :
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/ht
ml/progthrepool.asp

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.



 Reply:
by:Allen Anderson

 Sure, check out some of my articles on this subject. As for
concurrent requests, just create the object in any given thread you
want to access the server on and call to your hearts content.

http://www.glacialcomponents.com/ArticleDetail.aspx?articleID=CAOGuide

http://www.glacialcomponents.com/ArticleDetail.aspx?articleID=RemoteObject

Allen Anderson
http://www.glacialcomponents.com
mailto: allen@put my website url here.com




Posted by Xander Zelders
0 Comments



content files

Found the following interesting discussion in the Newsgroups:

content files
by:Brian Henry

Hi,

If you have files in your project (like text files and bmp files stuff like
that, and config files) and want to have it copied to the bin folder at
build (i thought setting the build action to content did this but it
doesnt?) how can i get them to copy at each build? thanks


 Reply:
by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP])

 * "Brian Henry" <brianiupmsdn@newsgroups.nospam> scripsit:
> If you have files in your project (like text files and bmp files stuff like
> that, and config files) and want to have it copied to the bin folder at
> build (i thought setting the build action to content did this but it
> doesnt?) how can i get them to copy at each build? thanks

For the application configuration, name the file "App.config" and add it
to your project. VS.NET will automatically copy it into the "bin"
folder and rename it accordingly. For the other files, you can create a
batch file that copies the files to the "bin" folder.

--
Herfried K. Wagner [MVP]


 Reply:
by:Brian Henry

 what is the difference between content and none then?


 Reply:
by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP])

 * "Brian Henry" <brianiupmsdn@newsgroups.nospam> scripsit:
> what is the difference between content and none then?

If it's content, it will be included in a setup package, AFAIK.

--
Herfried K. Wagner [MVP]


 Reply:
by:Brian Henry

 thanks!



Posted by Xander Zelders
0 Comments



A little overwhelmed with the number of options...

Found the following interesting discussion in the Newsgroups:

A little overwhelmed with the number of options...
by:Paul

hello,

My application is built in VB6 and i'd like to upgrade to VB.NET and make
some fairly large changes at the same time.

The application writes a script (simular to VBScript) for the user based on
their selection from combo boxes and entries into text boxes etc, the script
is then used in a seperate application. The app basically makes it easy for
someone who cannot code to create that code from english language
expressions.

What i'd like to do with VB.NET is to re-design the application with more of
an OO approach. I'd like the user to be able to drag functions from a
toolbox like structure and place them on a form (canvas is a better
description) then have access to the functions properties by LMC etc. The
user should be able to move the objects around on the canvas, delete them
etc. Basically its script in a graphical format with english language
description.
Once the user has finished dragging and dropping functions, filling in
properties, adding parenthesis and all the other things one does when
writing code they will be able to save the whole thing as a unit. The
resultant generated script code would also be color coded and presented to
the user in a seperate code window.
I'm also thinking about the option for users to type in code and generate
the graphical output.

I'd like the users to be able to add new functions to the toolbox.
I'll be adding lot of validation so options just wont be available for the
users to connect functions which obviously dont go together.
For me its going to be quite a challange because I'm use to procedural
programming not OO.

What I was wanting is some general pointers from programmers about the best
approach to take for the various aspects of the application
ie.

What would be the best approach to build the toolbox bearing in mind the
users need to be able to add new functions.

Would the best approach to the 'canvas' be to use a form and GDI+

Does anyone know of a sample application that I could learn some of these
approaches from.

I've been reading many books and have done much searching on the net for
tips and methods to approach these tasks and am feeling a little overwhelmed
with the labrinth of possibilities, so if you can narrow down the
possibilities i would be greatful. I'm not looking for detailed explanations
of how to do these tasks just general pointers in the right direction.

Regards,
Paul


 Reply:
by:Paul

 I guess it might be an idea to break this down into smaller chuncks:

Looking for pointers on creating a toolbox in my application for users
during application runtime. They also need to be able to add new functions
(tools) to the toolbox.

If you know of a sample application to demonstrate some of the concepts that
would be very helpful.

Thanks.
Paul



Posted by Xander Zelders
0 Comments



VB.Net Windows App Data Grid

Found the following interesting discussion in the Newsgroups:

VB.Net Windows App Data Grid
by:justjump@yahoo-dot-com.no-spam.invalid (JJump)

Ok I'm trying to create a datgrid. I got data in there from a
dataset, but it's not how I want it. I want to format it and put a
checkbox for each row and a delete button to delete all checked.
I've found tutorials for how to do this in web stuff..but not in a
windows application. HELP!
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com


 Reply:
by:William Ryan eMVP

 You'll need to apply a DataGridTableStyle and from there, A
DataGridColumnStyle http://www.knowdotnet.com/articles/kdngrid.html
HTH,

Bill

--

W.G. Ryan, eMVP

http://forums.devbuzz.com/
http://www.knowdotnet.com/williamryan.html
http://www.msmvps.com/WilliamRyan/
http://www.devbuzz.com/content/zinc_personal_media_center_pg1.asp



Posted by Xander Zelders
0 Comments



Avoid IE control resizing ?

Found the following interesting discussion in the Newsgroups:

avoid IE control resizing ?
by:Anonymous

I built a vb application which use internet explorer control (shdocvw.internetexplorer).
How can I avoid javascript resizing for web site with such commands :

top.window.moveTo(0,0);
if (document.all) {
top.window.resizeTo(screen.availWidth,screen.availHeight);

I set explorer.resizable=false but this doesn't avoid the problem.



 Reply:
by:Cor Ligthert

 Hi Oliver

I have it in this way,

Private Sub AxWebBrowser1_WindowSetResizable(ByVal sender As System.Object,
ByVal e As AxSHDocVw.DWebBrowserEvents2_WindowSetResizableEvent) Handles
AxWebBrowser1.WindowSetResizable
e.resizable = False
End Sub

It helps better, however still not forever.

Cor


 Reply:
by:Anonymous

 Thanks Cor but it doesn't work. Internet explorer control event is different than the one of axwebbrowser. I tried

Private Sub explorer_WindowSetResizable(ByVal Resizable As Boolean) Handles explorer.WindowSetResizable
Resizable = False
End Sub

but the windows went to full screen on http://www.nc-c.net



 Reply:
by:Cor Ligthert

 Hi Oliver,

I was not sure from your message which one you was using and also not which
part is in shdocvw implemented and which not, the IE part acts often not as
you would expect when you read the documentation, because the documentation
is than for the axshdocvw.

Cor



Posted by Xander Zelders
0 Comments



Visual Studio Web Forms vs. Access 2003 Forms

Found the following interesting discussion in the Newsgroups:

Visual Studio Web Forms vs. Access 2003 Forms
by:Anonymous

I'm redesigning my Access Form in Visual Studio (asp.net) so that I can have a Web application connected to the Access Database. It is a user form. Is there any way to have a subform in Visual Studio?

I'm trying to keep from making too many changes, since the users have been using this form (wireless) and we now want to be Web based. Is there a better way to make my Access Database (forms, tables, etc...) web based - without redesigning and recoding everything (it's a very large project).

Please help.
Thanks-
Gena


 Reply:
by:Cor Ligthert

 Hi Gena,

Did you ask this question as well in the newsgroup

microsoft.public.dotnet.framework.aspnet

I think that you have there a better change on this question, which does not
say that you do not get your answer here.

Cor


 Reply:
by:Gena Thompson

 Hi Cor,
Thanks for responding. I'm new to newsgroups :)

Yes, I did post my questions in more than one newsgroup. Hopefully
someone will be able to help me.

I'm in the process of making an MS Access 2003 database internet
accessible. I'd like to use the current forms (not redesign and
recode). Data Access Pages might be a possibility, but it doesn't seem
to work with Forms - just tables.

I'd appreciate any assistance.

Thanks -
Gena

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Posted by Xander Zelders
0 Comments



Newbie needs help with command line paramaters

Found the following interesting discussion in the Newsgroups:

Newbie needs help with command line paramaters
by:Anonymous

I have only been working with VB.NET for a couple of weeks. Can someone tell me how to get this to work?
I want to be able to call a program 'KillOldFiles' with two command line variables Days and Directory.

KillOldFiles 5,C:\test

When the above is run it should check the c:\test directory for files older that 5 days old and delete them.
I have found some references to System.Environment.GetCommandLineArgs() but cant figure out how it should work. Also is there a way to test/debug applications with command line paramaters?

Thanks,
Steve

#####Start Code#####
Sub Main(ByVal DaysOld As Integer, ByVal FilePath As String)

If Not IsNumeric(DaysOld) Then
Exit Sub
End If

If FilePath.Length = 0 Then
Exit Sub
End If

Console.WriteLine("Deleteing old files as specified")
' Create a reference to the current directory.
Dim di As New System.IO.DirectoryInfo(FilePath)
' Create an array representing the files in the current directory.
Dim fi As System.IO.FileInfo() = di.GetFiles()
'Console.WriteLine("The following files exist in " & FilePath & " :")
' Print out the names of the files in the current directory.
Dim fiTemp As System.IO.FileInfo
For Each fiTemp In fi
If Not fiTemp.CreationTime > DateAdd(DateInterval.Day, -(DaysOld + 1), Now()) Then
'Console.WriteLine("delete older than: " & DaysOld & " Name: " & fiTemp.Name & " Time: " & iTemp.CreationTime)
fiTemp.Delete()
'Else
'Console.WriteLine("keep newer than: " & DaysOld & " Name: " & fiTemp.Name & " Time: " & fiTemp.CreationTime)
End If
Next fiTemp

Console.WriteLine("Files Deleted")
End Sub 'main
#####End Code#####



 Reply:
by:Patrick Steele [MVP]

 
Actually, you'd probably want to do either:

KillOldFiles 5 C:\test

(NOTE: no commad) -- or get fancy and actually provide named-arguments
so they can be in any order:

KillOldFiles /d:5 /p:C:\test

Where "/d" is number of days and "/p" is path. The first option is
easier and requires less parsing.

> When the above is run it should check the c:\test directory for files older that 5 days old and delete them.
> I have found some references to System.Environment.GetCommandLineArgs() but cant figure out how it should work.

GetCommandLineArgs will return a string array. The first element (0)
will be the program name (killoldfiles.exe). After that, each element
will be the command line options entered. So in your case:

dim args() as string = Environment.GetCommandLineArgs()
' s(0) = "killoldfiles.exe"
' s(1) = "5"
' s(2) = "C:\test"

> Also is there a way to test/debug applications with command line paramaters?

Right click on the project in Solution Explorer and select properties.
Click on "Configuration Properties" and then "Debugging". Under the
"Start Options" section should be a textbox labeled "Command Line Args".
Put your data there:

5 C:\temp

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele


 Reply:
by:Anonymous

 Thank you for the information on the startup paramaters and the debugging.

It works now.

Thanks again,
Steve


 Reply:
by:Armin Zingler

 
It returns an array of Strings. It is declard by writing

dim args as string()

> Also is there a way to test/debug applications with
> command line paramaters?

Enter them in the project properties.
> #####Start Code#####
> Sub Main(ByVal DaysOld As Integer, ByVal FilePath As String)

/Either/ use System.Environment.GetCommandLineArgs /or/ add the arguments to
sub Main, and if you do the latter, you must declare an array:

Sub Main(Args As String())
> If Not IsNumeric(DaysOld) Then

If you declare an Integer variable, you don't have to check it for being
numeric.

> Exit Sub
> End If
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html



 Reply:
by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP])

 
.... see:

<URL:http://www.google.de/groups?selm=2fv6h2F2q74rU4%40uni-berlin.de>

--
Herfried K. Wagner [MVP]



Posted by Xander Zelders
0 Comments



How to decalre this in VB.net

Found the following interesting discussion in the Newsgroups:

How to decalre this in VB.net
by:Carlos

How do I deckare this in VB.net

static const BYTE baEnableScan[ 2] = {0x5A,0x18};

static const BYTE baDisableScan[2] = {0x5A,0x19};

static const BYTE baResetCmd[ 2] = {0x5A,0x00};

Thanks


 Reply:
by:Patrick Steele [MVP]

 In article <#HXY9J0QEHA.2032@TK2MSFTNGP11.phx.gbl>, cp@swa.com says...
> How do I deckare this in VB.net
>
> static const BYTE baEnableScan[ 2] = {0x5A,0x18};
>
> static const BYTE baDisableScan[2] = {0x5A,0x19};
>
> static const BYTE baResetCmd[ 2] = {0x5A,0x00};

I think it would be:

Shared baEnableScan as Byte(1) = new Byte() { &h5a, &g18 }
etc...

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele


 Reply:
by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP])

 * "Carlos" <cp@swa.com> scripsit:
> How do I deckare this in VB.net
>
> static const BYTE baEnableScan[ 2] = {0x5A,0x18};
>
> static const BYTE baDisableScan[2] = {0x5A,0x19};
>
> static const BYTE baResetCmd[ 2] = {0x5A,0x00};

\\Public ReadOnly baEnableScan() As Byte = {..., ...}
///

--
Herfried K. Wagner [MVP]



Posted by Xander Zelders
0 Comments



Full screen mode

Found the following interesting discussion in the Newsgroups:

full screen mode
by:Doominato

good day everyone,

i'm writing an app in which i would like to implement full-screen
capability.
i would like to know if there is a way of getting a program to cover the
whole
screen, such as in M$ word or in internet explorer. the only reason why i
mention ie and word is because they use some kind of an API method to handle
full sreen.
I know there is an easier way by maximizing the form window and setting it
to be TopMost and borderless,
but my program involves graphics and that makes for a very nasty resize and
flickering, even with double buffering.
so is there a way to do it through an API or some other method?

any help would be greatly appreciated thanks.


 Reply:
by:Brian Henry

 'M$' is so childish...

it's not hard, just set topmost property of a form to true, set the
windowstate to maximized and set the formborderstyle to none...


 Reply:
by:Brian Henry

 what kind of graphics anyways? topmost, boarderless and maxamized ive never
had a single problem with... it sounds like you need to optimize your
rendering procedures a lot if you have problems even with double buffered,
as for the API they do not use a special api to do what you stated in IE..
it's pretty much the max, boarderless, topmost.


 Reply:
by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP])

 
DirectX...

--
Herfried K. Wagner [MVP]



Posted by Xander Zelders
0 Comments



Application quits unexpectedly

Found the following interesting discussion in the Newsgroups:

Application quits unexpectedly
by:Andrew Teece

HELP - My application exists.... all on its own... at the end of a function
call!!!

The code snipit below runs... the finally block runs. But when it reaches
End Sub, it exists! - And the proceedure that calls this one, has code left
to run, but it never gets to a breakpoint on the next line.
Any ideas what to look for? Is it because i am calling an external assembly?

The calling code is run on a seperate thread, that is marked as background,
but that shouldnt make a difference should it?

Private Sub CreateOutput(ByVal Packet As Packet, ByVal ChannelInstance As
ChannelInstance, Optional ByVal PacketField As PacketField = Nothing)
Dim asmOutputChannel As System.Reflection.Assembly
Dim typOutputChannel As Type
Dim objOutputChannel As iOutputChannel

Try
asmOutputChannel =
System.Reflection.Assembly.LoadFrom(CType(ChannelInstance.ChannelTemplate,
ChannelTemplate).FileName)

typOutputChannel =
asmOutputChannel.GetType(CType(ChannelInstance.ChannelTemplate,
ChannelTemplate).ProgID, True, True)

objOutputChannel = Activator.CreateInstance(typOutputChannel)

objOutputChannel.SendOutput(Packet, ChannelInstance)
Catch ex As DataAccessLayer.RecordAlreadyChanged
'Pass this error up the stack, without a parent exception
Throw ex
Catch ex As Exception
Throw New AllocationsEngineException("Unable to create output", ex)
Finally
asmOutputChannel = Nothing
typOutputChannel = Nothing
objOutputChannel = Nothing
End Try
End Sub


 Reply:
by:CJ Taylor

 try adding a handler to Applicatoin.ThreadException and see if its being
thrown there.

-CJ'


 Reply:
by:Andrew Teece

 I already have an event handler here... nothing is thrown.

Thanks for the idea though


 Reply:
by:Anonymous

 It could be your call is not thread safe. Is this a call to unmanaged code?


 Reply:
by:Andrew Teece

 It is a call to a .Net assembly i have written in VB.Net, so fully managed
(it only calls system.web.mail).

However, the calling code is run within a COM+ transaction. The assembly i
dynamically load does not referance EnterpriseServices in any way, and i
have since noticed that COM+ throws a 4822 error..

A condition has occurred that indicates this COM+ application is in an
unstable state or is not functioning correctly. Assertion Failure: !m_punk

Server Application ID: {31DC9D6D-C0E1-4386-BF94-7E1A6964CE2B}

Server Application Instance ID:

{997DF313-3BFB-4031-AFB9-2A3B76660DD5}

Server Application Name: eNate BPOBridge

The serious nature of this error has caused the process to terminate.

COM+ Services Internals Information:

File: d:\nt_qxp\com\com1x\src\comsvcs\jit\jit.cpp, Line: 858

Comsvcs.dll file version: ENU 2001.12.4414.53 shp

For more information, see Help and Support Center at

"Doug" <anonymous@discussions.microsoft.com> wrote in message
news:11D7656A-9C60-494E-B433-EA010F4A3205@microsoft.com...
> It could be your call is not thread safe. Is this a call to unmanaged
code?



Posted by Xander Zelders
0 Comments



How to Strong Name

Found the following interesting discussion in the Newsgroups:

How to Strong Name
by:Derek Martin

<Sigh> - okay, I have given up on the hashing idea, I guess I am going to
have to break down and figure the sn gooo out. I keep getting this message
when strong naming my assembly (an exe):

Unable to Emit Assembly: Referenced assembly 'Interop.Scripting' does not
have a strong name.

I get the error - that DLL that I am using isn't strong named, but how does
one strong name an exisitng file that I just imported? I did a search for
scripting.dll, hoping it would be about, but no luck.

Can someone assist so I can get this thing to a position where I can run a
fun command like this on it:

caspol -enterprise -addfulltrust appname.exe

???
Thanks,
Derek


 Reply:
by:Patrick Steele [MVP]

 
If you want to strong name an assembly, all referenced assemblies must
have strong names too. It's a .NET requirement.

> I get the error - that DLL that I am using isn't strong named, but how does
> one strong name an exisitng file that I just imported?

If you added a reference to a COM object in VS.NET, it automatically
generates an RCW (Runtime callable wrapper) using tlbimp. However, it
uses basic default options (no signing).

If you want your wrapper signed, you'll need to create the interop
assembly yourself from the command line:

tlbimp file.dll /out:Interop.file.dll /keyfile:mykey.snk

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele


 Reply:
by:Derek Martin

 Hi Patrick, I've tried that, and get this error:
TlbImp error: The input file 'C:\projects\bin\Interop.Scripting.dll' is not
a valid type library

?


 Reply:
by:Patrick Steele [MVP]

 
You need to import the COM library. That looks like the already
converted DLL (the RCW). I think you're looking to import either
"msscript.ocx" or "scrrun.dll" from \WINNT\SYSTEM32.

tblimp C:\winnt\system32\scrrun.dll /out:interop.scripting.dll
/keyfile:mykey.snk

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele



Posted by Xander Zelders
0 Comments



Thread Form

Found the following interesting discussion in the Newsgroups:

Thread Form
by:Anonymous

I have the following code. I want Form2 to open in a new thread. It opens but closes right away. How do you open a form in a new thread?

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim th As Threading.Thread
th = New Threading.Thread(AddressOf StartForm2)
th.Start()
End Sub

Private Sub StartForm2()
Dim f As Form2
f = New Form2()
f.Show()
End Sub

I also tried it with f and th declared outside of the subs:
Inherits System.Windows.Forms.Form
Private f As Form2
Private th As Threading.Thread

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
th = New Threading.Thread(AddressOf StartForm2)
th.Start()
End Sub

Private Sub StartForm2()
f = New Form2()
f.Show()
End Sub


 Reply:
by:Armin Zingler

 
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html



 Reply:
by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP])

 
It's better to open the form from the main thread, by telling it to open
a new form.

When closing the form that creates the thread with the 2nd form, your
application looses its message loop. You can use 'Application.Run(f)'
instead of calling the form's 'Show' method, but I still recommend to do
all UI stuff in the main thread and communicate with the main thread by
invoking.

--
Herfried K. Wagner [MVP]


 Reply:
by:Patrick Steele [MVP]

 In article <FE2151B1-B000-4175-B69C-0D2F4F0E7635@microsoft.com>,
anonymous@discussions.microsoft.com says...
> I have the following code. I want Form2 to open in a new thread.
> It opens but closes right away. How do you open a form in a new thread?

Windows forms applications have a "message pump" running on a thread
that pumps all of the input messages and other windows messages (paint,
resize, etc..) to your application. This message pump is started
automatically on your main thread when you do:

Application.Run(form)

I'm not sure you can start up a second message pump on another thread
from the main thread.

Why do you want to do this?

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele



Posted by Xander Zelders
0 Comments



mutli threaded application shuts down all copies of access when issueing quit co

Found the following interesting discussion in the Newsgroups:

mutli threaded application shuts down all copies of access when issueing quit co
by:stmthoma@gapac.com (Steven Thomas)

I have a windows service that uses office xp automation. Here is the
code
---------------------------------------
Public Sub CAccessSnapShot()
Try
Dim objAccess As New Access.Application()
Dim vSQLText, vThreadName As String
Try
vThreadName = Thread.CurrentThread.Name
cFunctions.WriteEventLog("starting report on thread: "
& pDBType)
Dim dtSQLText As DataTable
' GET THE SQL ASSOCIATED WITH THIS REPORT
dtSQLText = cFunctions.GetSQL(pReportRefNum,
pQConnectionString)
vSQLText = CStr(dtSQLText.Rows(0).Item("SQLText"))
Dim strMDBName, strSNPName, strAccessFuncNm As String
' GET THE NAME OF THE TEMPORARY MDB AND MAKE A COPY
TO WORK WITH
strMDBName = cFunctions.GetNewFileName(".mdb")
strMDBPath = pInputFileDir + strMDBName
System.IO.File.Copy(pInputFileDir + pInputFileName,
pInputFileDir + strMDBName)
' OPEN THE NEW COPY OF THE MDB
objAccess.OpenCurrentDatabase(pInputFileDir +
strMDBName)
' GET THE NEW NAME OF THE SNAP FILE
strSNPName = cFunctions.GetNewFileName(".snp")
strAccessFuncNm = "rpt" + pReportName
' RUN THE FUNCTION FROM ACCESS TO CREATE THE REPORT
SNAPSHOT
objAccess.Run("RunReports", pReportName, vSQLText,
pOutputFileDir, strSNPName, pConnectString)
' SHUT DOWN ACCESS AND RELEASE THE COPY FROM MEMORY
objAccess.DoCmd().Quit(Access.AcQuitOption.acQuitSaveNone)
' ------
System.Runtime.InteropServices.Marshal.ReleaseComObject(objAccess)
' UPDATE THE QUEUE WITH THE SNAP SHOT NAME AND DELETE
THE COPY OF THE MDB
cFunctions.WriteEventLog("complete report on thread: "
& vThreadName)
cFunctions.UpdateRptComplete(pReportRefNum,
strSNPName, pQConnectionString)
System.IO.File.Delete(strMDBPath)
'RaiseEvent ThreadDone(pDBType)
Catch errorVariable As Exception
'Error trapping
cFunctions.UpdateReportError(pReportRefNum,
errorVariable.Message.ToString, pQConnectionString)
cFunctions.WriteEventLog("GPReportServer.NET-Error: "
& errorVariable.Message.ToString)
objAccess.DoCmd().Quit(Access.AcQuitOption.acQuitSaveNone)
' -----
System.Runtime.InteropServices.Marshal.ReleaseComObject(objAccess)
Finally
RaiseEvent ThreadDone(pDBType, vThreadName)
End Try
'CType(state, AutoResetEvent).Set()
Catch
Catch errorVariable As Exception
'Error trapping
cFunctions.UpdateReportError(pReportRefNum,
errorVariable.Message.ToString, pQConnectionString)
cFunctions.WriteEventLog("GPReportServer.NET-Error: " &
errorVariable.Message.ToString)
End Try
End Sub

-----------------------------------------------------
I have a driver sub routine that creates a set of threads. Then on
each tread it calls this sub if there is a request for an access
report. He problem is if 2 or more threads are running at the same
time, when the first thread ends and issues the quit, it seems to
affect all instances of access in memory. The all stop running. How
can I issue the quit to just the thread this sub is running on???


 Reply:
by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP])

 * stmthoma@gapac.com (Steven Thomas) scripsit:
[...]

Double post.

--
Herfried K. Wagner [MVP]



Posted by Xander Zelders
0 Comments



Killing off a Descendant

Found the following interesting discussion in the Newsgroups:

Killing off a Descendant
by:Phill. W

Here's another little challenge.

I have a [base] Form from which lots of others will be derived.
One of the base Form properties is a communication "channel"
to an external application. If this external application isn't running,
I want to /prevent/ the creation of the derived Form (essentially
kill the [derived] application stone dead).

I tried throwing an Exception, but being in the Form constructors,
there's nowhere I can easily catch it again, so I get the JIT Debugger
dialog - presumably my users would get something similarly unpleasant.
I even tried (gasp) Application.Exit() but that doesn't seem to work as
I thought it would - given:

[base Form class]

#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
Try
ConnectToExternalApp()
Catch ex as MyException
Me.Close()
Me.Dispose()
Application.Exit()
End Try

End Sub

Even with the above, execution resumes in the Sub New() of the
derived Form, although that immediately bombs out with an
ObjectDisposedException - which I can't seem to catch.

Any Suggestions?

TIA,
Phill W.


 Reply:
by:Armin Zingler

 
Don't catch the exception in the constructor, so you'll get it where you
create the instance:

dim f as YourForm
try
f = new YourForm
catch
end try
I'd probably do the "ConnectToExternalApp" outside the Form and only create
an instance and pass the necessary data to the Form if ConnectToExternalApp
was successful. This can be put in a Shared Function within the Form class,
and the Function returns a new instance.
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html



 Reply:
by:Phill. W

 
Ah! I don't (yet). The inherited form is the "main" (and usually only)
form in the application, and VB is currently starting it for me
- presumably, I'm going to have to change this and insist that my
Developers use Sub Main to get all their programs up and running?

Regards,
Phill W.


 Reply:
by:Armin Zingler

 
If you want to check something /before/ creating the main Form, yes, you'd
have to write a sub main. That's what I would do, but others will perhaps
make other suggestions. I don't like interrupting creating/showing a Form,
and I also prefer to use a Form only as the user interface and do jobs like
'ConnectToExternalApp' outside the Form, at least if both reasons come
together.
--
Armin




Posted by Xander Zelders
0 Comments



ISynchronizeInvoke.Invoke call

Found the following interesting discussion in the Newsgroups:

ISynchronizeInvoke.Invoke call
by:Thai Mai Shu

What is wrong with my call below. If I change the
delegate and the CallBackComplete function to not take in
parameters then the .Invoke call works fine. As soon as I
put the parameters back I get "Parameter count mismatch."
error. Am I supposed to implement ISynchronizeInvoke in
order to call .Invoke? If so, why does it work when the
method i am trying to invoke has no parameters.

Private Delegate Sub CallbackCompleteDelegate(ByVal args()
As Object)

Private Sub SomeCallback(ByVal ACResult As IAsyncResult)
' calls .EndInvoke and does some async work

Dim Test As New CallbackCompleteDelegate(AddressOf
CallbackComplete)

Dim args(1) As Object
args(0) = "one"
args(1) = "two"

MainForm.Invoke(Test, args)
End Sub

Private Sub CallbackComplete(ByVal args() As Object)
' not even accessing the parameters

Debug.WriteLine("CallbackComplete - " &
AppDomain.GetCurrentThreadId)
End Sub


 Reply:
by:

 Your delegate and CallbackComplete need to list out the
parameters and not take them in as an array. So...

Private Delegate Sub CallbackCompleteDelegate(ByVal one As
Object, ByVal two As Object)

Private Sub SomeCallback(ByVal ACResult As IAsyncResult)
' calls .EndInvoke and does some async work

Dim Test As New CallbackCompleteDelegate(AddressOf
CallbackComplete)

Dim args(1) As Object
args(0) = "one"
args(1) = "two"

MainForm.Invoke(Test, args)
End Sub

Private Sub CallbackComplete(ByVal one As Object, _
ByVal two As Object)
' not even accessing the parameters

Debug.WriteLine("CallbackComplete - " &
AppDomain.GetCurrentThreadId)
End Sub




Posted by Xander Zelders
0 Comments



How to build *.dll ?

Found the following interesting discussion in the Newsgroups:

How to build *.dll ?
by:Agnes

I create two project A, & B . A included several baseforms like search,
print,etc
For project B , some form will inherits the forms in prjA .
In project B, I try to add the referece of prjA and I am fail, i can't find
any *.dll in prjA.
How can I build the *.dll of prj A?

Thanks A lot.
From Agnes


 Reply:
by:Armin Zingler

 
In the project properties, change the project type of project A to
"Classlibrary".
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html



 Reply:
by:William Ryan eMVP

 If they are in the same solution, one really convenient way is to just use
Project -> Add Reference and on the Project tab, add the project which
should already be in there. If not, you can browse to it. This will
automatically shift the build order so the dependencies are built first
(assuming there are changes made) so it's very convenient

--

W.G. Ryan, eMVP

http://forums.devbuzz.com/
http://www.knowdotnet.com/williamryan.html
http://www.msmvps.com/WilliamRyan/


 Reply:
by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP])

 
Are you sure 'prjA' is of type "Class library"? If it's not, you can
change that in the project properties. If you are using VB.NET
Standard, you will have to use this workaround to be able to create
class libraries:

<URL:http://www.google.de/groups?selm=3D0EB6F8.5040805%40brienen.net>

--
Herfried K. Wagner [MVP]


 Reply:
by:Agnes

 Thanks a lot, I don't know "I need to set prjA as class libraries" . In the
very beginning, I set it as window applications.
Thanks a lot



Posted by Xander Zelders
0 Comments



Programaticly shift the fucus from treeview to child form

Found the following interesting discussion in the Newsgroups:

Programaticly shift the fucus from treeview to child form
by:feng

Hi,

I have a MDI container that contains a treeview and a
child form. Clicking on a tree node will open the child
form. Right now, the focus stays with the treeview, even
after the child form is loaded. When I want, however, is
that after a tree node is clicked, and a child form is
loaded, the focus should be shifted to the child form. How
to do that? I tried in the MDI container form to set focus
but it doesn't seem to work.

Please help!

Thanks


 Reply:
by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP])

 
Did you try to call the child form's 'Activate' method?

--
Herfried K. Wagner [MVP]


 Reply:
by:feng

 I just tried that. It doesn't seem to make any
difference...


 Reply:
by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP])

 
Mhm...

--
Herfried K. Wagner [MVP];



Posted by Xander Zelders
0 Comments



VB xml comment

Found the following interesting discussion in the Newsgroups:

VB xml comment
by:feng

Hi,

I heard that since VS.Net 2003, there is a tool available
for VB.Net that I can use to create XML comment, just like
I can do under C#. Does anyone know where I can find this
tool?

Thanks


 Reply:
by:Cor Ligthert

 The links are maybe a little bit old.

VB Commenter
<http://www.gotdotnet.com/team/ide/>
-> section "VB Commenter"

XML Documentation
<http://www.gotdotnet.com/team/vb/>
-> section "XML Documentation"

VBXC - VB.NET XML Commentor
<http://vbxmldoc.tor-erik.net/index.shtml>

NDOC (formerly DOC.NET)
<http://ndoc.sourceforge.net/>

VB.DOC
<http://vb-doc.sourceforge.net/>

<http://www.gotdotnet.com/Community/Workspaces/Workspace.aspx?id=112b5449-f7
02-46e2-87fa-86bdf39a17dd>
I hope this helps a little bit?

Cor


 Reply:
by:mwazir

 Hi there,

Check for a recent thread "How to create documentation for my code" on
25/05/2004
A few links have been posted like VB Commenter.

http://www.gotdotnet.com/team/ide/

HTH


 Reply:
by:hirf-spam-me-here@gmx.at (Herfried K. Wagner [MVP])

 
There is more than one tool available for this purpose:

For VB.NET 2002/2003:

My XML Comments FAQ:

VB Commenter
<URL:http://www.gotdotnet.com/team/ide/>
-> section "VB Commenter"

XML Documentation
<URL:http://www.gotdotnet.com/team/vb/>
-> section "XML Documentation"

VBXC - VB.NET XML Commentor
<URL:http://vbxmldoc.tor-erik.net/>

NDOC (formerly DOC.NET)
<URL:http://ndoc.sourceforge.net/>

VB.DOC
<URL:http://vb-doc.sourceforge.net/>

<URL:http://www.gotdotnet.com/Community/Workspaces/Workspace.aspx?id=112b5449-f702-46e2-87fa-86bdf39a17dd>

XML comments will be introduced to VB.NET in version 2005 ("Whidbey").

C# XML comments:

<URL:http://msdn.microsoft.com/library/en-us/csref/html/vclrfTagsForDocumentationComments.asp>

--
Herfried K. Wagner [MVP]



Posted by Xander Zelders
0 Comments



 
Previous Posts
    - The SqlCommand Guide
    - Obtain scrollbar width.
    - Mail Merge with PDF
    - Socket connection in a web app?
    - Quick Tutorial - VB6 to .NET
    - Moving between forms in VB.NET
    - Is form closed?
    - Determine if property exists at runtime?
    - How to convert VB6 Type To .NET Structure
    - How to create a suimple virtual directory with def...

Archives
    - 10/03/2004 - 10/10/2004
    - 10/10/2004 - 10/17/2004
    - 10/17/2004 - 10/24/2004
    - 10/24/2004 - 10/31/2004
    - 10/31/2004 - 11/07/2004
    - 11/21/2004 - 11/28/2004
    - 11/28/2004 - 12/05/2004
    - 12/05/2004 - 12/12/2004
    - 12/12/2004 - 12/19/2004
    - 12/19/2004 - 12/26/2004
    - 12/26/2004 - 01/02/2005
    - 01/23/2005 - 01/30/2005
    - 01/01/2006 - 01/08/2006
    - 09/24/2006 - 10/01/2006


Disclaimer & Terms of Use | DotNet4All.Com concept & © 2004 - 2007 by Zelders² - Holland