Home | Index | Dotnet4all Snippets | Submit resources
About | Mail us 
Dataset Tablenames <- SQLHelper (Thursday, January 26, 2006)

Found the following interesting discussion in the Newsgroups:

Dataset Tablenames <- SQLHelper
by:Lucas Tam

I'm not sure if this is a problem with Microsoft's Application Data Blocks,
but I am using a query like this:

USE DATABASENAME;SELECT * FROM SOMETABLE

The tablename property of my datasets are not being set - this causes a
problem with CrystalReports.

Is there a way to auto-set the Tablename in a dataset?

Thanks.

--
Lucas Tam


 Reply:
by:Josh Golden

 use FillDataset instead of ExecuteDataset. here's the signature on one of
them. as you can see, the tableNames() array is for this.

Public Overloads Shared Sub FillDataset(connectionString As String,
commandType As CommandType, commandText As String, dataSet As DataSet,
tableNames() As String)


 Reply:
by:Lucas Tam

 
Shoot, I was hoping there was some automatic way to pick up the table names
from the database. I'm using System.Reflection to dynamically instantiate
my functions, so any manual work is a bit hard to do.

Anyhow, thanks for your help!

--
Lucas Tam



Posted by Xander Zelders
0 Comments



Add handlers to textboxes in a datagrid

Found the following interesting discussion in the Newsgroups:

add handlers to textboxes in a datagrid
by:Josh Golden

sorry for so many posts recently

i am loading a datagrid from a datatable. the shape of the datatable is not
known at design time. i want to dynamically add event handlers to the
datagrid textboxes. it would be really easy if i were using a
DataGridTableStyle at design time but that means i know the columns.

how do i loop through the textboxes in the datagrid? i will have to do this
after i've used the setDataBinding method of the datagrid. that's the only
way how i will know how many columns (DataGridTextBoxColumn) there are.

for each x as DataGridTextBoxColumn in dgOrders.< ? >
AddHandler x.TextBox.MouseDown, New MouseEventHandler(AddressOf
someMouseDownEvent)
AddHandler x.TextBox.DoubleClick, New EventHandler(AddressOf
someDoubleClickEvent)
next


 Reply:
by:Cor Ligthert

 Josh,

not

When the shape of the datasource is not known at runtime you have no
datagrid at runtime as well, so what do you mean with that sentense?.

However when you want to do something with an event in a databox from a
datagrid, mayby you can than use this sample that I once made?

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:Anonymous

 I am not sure how you can load the grid and not know the column count. Are you loading the grtid with a dataset? If so see this example.

http://www.wizkil-webs.net/NET/DotNET_Code_Samples.htm#_Toc76871990

If not I agree with Cor.

B


 Reply:
by:Cor Ligthert

 Hi Brian,

A dataset is a collection of datatables, where ever you get them, it has to
be there at runtame to be usable with a datagrid. (And the runtime moment is
the moment it is connected as a datasource to the datagrid).
..
A datagrid has always a datasource whatever it is or it has no rows and no
cells.

So why do you not agree with me?

Cor
Are you loading the grtid with a dataset? If so see this example.


 Reply:
by:Anonymous

 I know that.. and I did agree with you

B



Posted by Xander Zelders
0 Comments



Datagrid (windows forms)

Found the following interesting discussion in the Newsgroups:

Datagrid (windows forms)
by:Anonymous

is there like a BeforeColumnEdit() or BeforeRowEdit() event in the datagrid.

i want to disable a command button when a row in the grid is dirty. (i.e. a column is being currently edited) and enable it after the Changed() or Validated event fires

i tried the RowChanging(), ColumnChanging() events. but it didnt work.


 Reply:
by:Ken Tucker [MVP]

 Hi,

I would add a handler to the datagridtextboxcolumns textbox
textchanged and validating events to enable or disable the command buttons.

Dim colName As New DataGridTextBoxColumn

With colName

..MappingName = "LastName"

..HeaderText = "Name"

..Width = 100

End With

AddHandler colName.TextBox.TextChanged, AddressOf TextBox_TextChanged

AddHandler colName.TextBox.Validating, AddressOf TextBox_Validating

Private Sub TextBox_Validating(ByVal sender As Object, ByVal e As
System.ComponentModel.CancelEventArgs)

Debug.WriteLine("Validating")

End Sub

Private Sub TextBox_TextChanged(ByVal sender As Object, ByVal e As
System.EventArgs)

Debug.WriteLine("Text changed")

End Sub

Ken



Posted by Xander Zelders
0 Comments



Inheritance problem with custom control

Found the following interesting discussion in the Newsgroups:

Inheritance problem with custom control
by:Fred Flintstone

This is driving me crazy. I've put together a perfect, easy example of
the problem. What I'm doing is creating a custom control, prepopulated
with 4 items when dropped on a form:

- Create a new Control Library project.
- Inherit System.Windows.Forms.Combobox
- In New(), add this:

Me.Items.Add("Test1")
Me.Items.Add("Test2")
Me.Items.Add("Test3")
Me.Items.Add("Test4")

- Build.
- Start a sample project.
- Drop the new control on the form
- Run.
- Pull down combo:

The combo containts Test1 - Test4, TWICE.

The problem is, when the new control is dropped on a form, it adds
this to the "Windows Form Designer Generated Code":

'
'TestCombo1
'
Me.TestCombo1.Items.AddRange(New Object() {"Test1", "Test2", "Test3",
Me.TestCombo1.Location = New System.Drawing.Point(64, 80)
Me.Morecode...

I can't write any pre-initialized controls because the initialization
is always copied to the application it's being used in, duplicating
the code as demonstrated here. How do I prevent inheritance of the
iniitialization code? (or any code for that matter)

Thanks!!!


 Reply:
by:Anonymous

 Use following code can avoid your problem:

Dim myArray As String() = {"Test1", "Test2", "Test3", "Test4"}
Me.DataSource = myArray

Do not need Me.Items.Add("Test1")
Me.Items.Add("Test2")
Me.Items.Add("Test3")
Me.Items.Add("Test4")
any more





Posted by Xander Zelders
0 Comments



Master details grid remove the cross

Found the following interesting discussion in the Newsgroups:

master details grid remove the cross
by:Anonymous

Hello,
I have created a master details grid relationship as shown below:

Dim MySqlDataAdapter As SqlDataAdapter
Dim MyjbFunctions As New jobfunctions
Dim MyDataAccess As New DataAccess.DataAccess

Call MyjbFunctions.SetupGrid(MyDataset, MyMasterGrid, strMasterQuery, MasterTable)
Call MyDataAccess.AddTableToDataset(Connection, MySqlDataAdapter, MyDataset, strDetailQuery, DetailTable)

Dim MyMasterTable, MyDetailTable As DataTable
Dim MyMasterColumn, MyDetailColumn As DataColumn

MyMasterTable = MyDataset.Tables.Item(MasterTable)
MyDetailTable = MyDataset.Tables.Item(DetailTable)

MyMasterColumn = MyMasterTable.Columns(MasterColumn)
MyDetailColumn = MyDetailTable.Columns(DetailColumn)

MyDataset.Relations.Add(RelationName, MyMasterColumn, MyDetailColumn)

MyDetailGrid.DataSource = MyMasterTable
MyDetailGrid.DataMember = RelationName

All is fine except I wish to know how to remove the + in the master grid and just have single rows of data in each grid.
Regards

Geri


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

 Geraldine,
Set the DataGrid.AllowNavigation property of each grid to false.

Hope this helps
Jay

strMasterQuery, MasterTable)
MySqlDataAdapter, MyDataset, strDetailQuery, DetailTable)
MyDetailColumn)
and just have single rows of data in each grid.



Posted by Xander Zelders
0 Comments



Unicode/international

Found the following interesting discussion in the Newsgroups:

Unicode/international
by:Wardeaux

I'm looking for information on writing a program (asp.net and desktop
vb.net) for Asia starting with Japan. I already have an ASP.NET app written
with the functionality desired, but I did not take into consideration
Unicode when writing (my bad, I know...) I'm looking for info/tips on how to
convert/rewrite in Unicode so that I can market in Japan.

1) How can I convert non-Unicode program to Unicode standard?
2) Any tips or "gotcha"s to be aware of/

MTIA
wardeaux


 Reply:
by:Cor Ligthert

 Jo Wardeaux,

Why not ask this in a newsgroup as
microsoft.public.jp.dotnet.dotnet.vsnet

It is a very empty newsgroup however I saw every message is answered.

And do not forget to excuse yourself for writing in English,

I hope this helps something,

Cor


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

 

I am not sure what your question is about. Are you referring to the
encoding the files are encoded with?

--
Herfried K. Wagner


 Reply:
by:Wardeaux

 Herfried,
thanks for the reply... no I'm just trying to figure out what I need to do
to get my asp.net app to market in Japan... :) maybe a silly question, just
not one I've explored before...
MTIA!
wardeaux



Posted by Xander Zelders
0 Comments



SQLDMO error in .NET

Found the following interesting discussion in the Newsgroups:

SQLDMO error in .NET
by:Anonymous

I've been trying to use SQLDMO in a web app using VB .NET 2002. SQLDMO is registered on my system and I can use the CreateObject("SQLDMO.SQLServer") in both VBScript and Excel VBA code. Also SQL Enterprise Manager works fine. SQLServer SP3a has also been applied on my system.

I created the reference to SQLDMO in my project and the Interopt.SQLDMO.dll is created. I can view the structure of the Interopt.SQLDMO assembly in the VS Object Browser. Here is the code in the ASPX.VB component:

Imports SQLDMO

Public Class WebForm1
Inherits System.Web.UI.Page
Protected oSvr As SQLDMO.SQLServer

#Region " Web Form Designer Generated Code "

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
oSvr = New SQLDMO.SQLServer()
End Sub

End Class

When I run the code I get this error when the code hits the oSvr = New SQLDMO.SQLServer() line:

COM object with CLSID {10020200-E260-11CF-AE68-00AA004A34D5} is either not valid or not registered.

The GUID points to the CLSID for SQLDMO in the registry. I'm also at the base release for .NET Framework 1.0. Yes, I tried SP2 for .NET 1.0.

Is there anything else I can try?

Thanks,
Pete


 Reply:
by:Anonymous

 Pete,

Does the "Launch IIS Process Account" have permission to read the registry keys required by SQLDMO? It won't by default. Try giving it full read access to the root of HKEY_CLASSES_ROOT then test again.

If it works then it is a security issue with the registry and you will need to delve a bit deeper and workout what keys it needs permission to but it will point you in the right direction.

Chris.


 Reply:
by:Anonymous

 Chris,
No good on the permissions. I added that user to the local Administrators group on the system and the errorstill came up. I have another preson in my group that this works fine for. His system had no groups set for the IIS account.



 Reply:
by:Ken Tucker [MVP]

 Hi,

I am not getting that error with vs.net 2003 using ver 1.1 of the
framework. There is a tech preview of service pack 3 for framework ver 1.0
available. (Use at own risk.)

http://www.microsoft.com/downloads/details.aspx?FamilyId=CF52CA95-F2CC-459F-87EE-C17D16E22F08&displaylang=en
Ken


 Reply:
by:Anonymous

 Here's an update. It works now!!!

I tested the Interop interface with the SQLXML COM object and it worked fine. At least this showed that .NET install was good.

I then did a full removal of MSDE and the SQL Server client software. After the uninstall, I went throuhg the registry and removed every last vestage of SQLDMO I found. It looked like many of the registry entries were still left there even after the uninstall. I also deleted all the SQL Server directories under the "Program Files" directory.

I ran the install of the SQL Server client software and applied SP3a to it. After that, NO ERRORS!!!

So0mething was hosed on my system when it came to SQLDMO. The full wipe and install put it right.

Practice Safe Hex,
Pete



Posted by Xander Zelders
0 Comments



Can't write to the event log

Found the following interesting discussion in the Newsgroups:

can't write to the event log
by:Anonymous

I am trying to write to the event log when my vb 6.0 client calls my vb.net dll but it won't do it. It will write to the event log when a vb.net client calls the vb.net dll. I think it is a security issue but what I don't know, any suggestions would be helpful.
The vb.net dll works otherwise with the vb 6.0 client, just not when writing to the event log.

Thanks,
Kent


 Reply:
by:Anonymous

 What kind of exception are you see, if any? Also, a little code would help...

--
David Williams


 Reply:
by:Anonymous

 The .NET dll returns a type mismatch error to the VB 6.0 client, which is ok, but I'm trying to pin point where the error is happening, so I put in code to write to the event log at certain points in the function call. Again this code works when a .net client calls the dll but not VB 6.0 client. Other parts of the functions work with the VB 6.0 client just not the writing to the event log.

Here's some code

VB 6.0 client:

Private sub button_click()
dim cr as new clsInfo
dim bln as boolean

bln = cr.GetBoolean

error handler code...

end sub

..NET dll code
Imports System.Diagnostics

class clsInfo

Function Get boolean( ByVal a_strAcct as string) as Boolean
Dim EvtLog As New System.Diagnostics.EventLog

If Not EvtLog.SourceExists("PTSDataAccess") Then <--This doesn't work?
EvtLog.CreateEventSource("PTSDataAccess", "Application")
End If

EvtLog.Log = "Application"
EvtLog.WriteEntry("PTSDataAccess", "Starting", EventLogEntryType.Information, 0) <-- This doesn't work

do stuff here..... <-- works
End Function

end class


 Reply:
by:Greg Burns

 This doesn't appear to be your problem, but here goes anyways: :^)

You have to have high (is it administrator?) priveleges to create an
EventSource. Once created, any user can write to it.

Some solutions are:
#1 run program with elevated permissions the first time so EventSource gets
created.
#2 manually create it yourself in the registry prior to first run.
#3 have it be created during installation within setup project

HTH,
Greg.


 Reply:
by:Anonymous

 One more bit of info: the dll is a com+ component





Posted by Xander Zelders
0 Comments



Communication

Found the following interesting discussion in the Newsgroups:

Communication
by:André Almeida Maldonado

Hey Guys,

I need to communicate with a COM1 port. I can do it with the BaseComm class
from Micrsoft. But I need to listen the answer from the printer, and with
this class I can't do it....

Any idea????

Thank's


 Reply:
by:Dick Grier

 Hi,

The class from Microsoft "should" do the job. Why is it that you cannot use
it?

You can download NETComm.ocx from my homepage and I have my own class in my
book (see below), too. Also, there are a number of others available on the
Internet, including a version of Sax Com .NET in the Visual Basic .NET
Resource Kit, which may be downloaded from Microsoft, or ordered on CD-ROM
for a small shipping fee. The Resource Kit has lots of other useful tools,
too.

Dick

--
Richard Grier

See www.hardandsoftware.net for contact information.

Author of Visual Basic Programmer's Guide to Serial Communications, 3rd
Edition ISBN 1-890422-27-4 (391 pages) published February 2002.


 Reply:
by:Cor Ligthert

 In addition to Dick the adress of the resource kit.

VB.net Resource kit
http://msdn.microsoft.com/vbasic/vbrkit/default.aspx

And if you have problems installing the resource kit
http://msdn.microsoft.com/vbasic/vbrkit/faq/#installvdir


 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



Posted by Xander Zelders
0 Comments



Crystal report

Found the following interesting discussion in the Newsgroups:

crystal report
by:mahdi haeri

I developed an application which uses crystal report in its reports.
when I install the application in other computers,
the program doesn't start because of an error in crystal report DLL files.
but when I open this program in vb.net for first time on that computer,
the program runs correctly.

what's your idea..............

thanks.


 Reply:
by:Anonymous

 You might want to take a look at :
http://support.businessobjects.com/communityCS/TechnicalPapers/crnet_deployment.pdf

This document discusses how to create an application deployment project to allow you to seamlessly deploy Crystal Report for Visual Studio .NET (this version is installed with Visual Studio .NET) on a client or server computer. This document is for use with Crystal Reports for Visual Studio .NET and later versions.




 Reply:
by:Anonymous

 Also there is a new CR Crystal Depolyment pac on their site along with a new service pac.





Posted by Xander Zelders
0 Comments



api call using struct*

Found the following interesting discussion in the Newsgroups:

api call using struct*
by:Anonymous

Hail to the Gurus, :)

I just read some of the 'api call to tchar*' thread but this is not about my problem.
I'm using a dll (eyelink_exptkit20.dll) that I've succesfully used from vb6. Among others I declare:

Public Declare Function StartRecording Lib "eyelink_exptkit20.dll" _
Alias "start_recording" (ByVal file_samples As Integer, ByVal file_events As Integer, _
ByVal link_samples As Integer, ByVal link_events As Integer) As Short

Public Declare Sub StopRecording Lib "eyelink_exptkit20.dll" Alias "stop_recording" ()

Public Declare Function NewestFloatSample Lib "eyelink_exptkit20.dll" _
Alias "eyelink_newest_float_sample" (ByRef NewSample As TrackerSample) As Int16
The original c struct of 'TrackerSample' looks like this:

typedef struct {
UINT32 time; /* time of sample */
INT16 type; /* always SAMPLE_TYPE */
UINT16 flags; /* flags to indicate contents */
// binocular data: indices are 0 (LEFT_EYE) or 1 (RIGHT_EYE)
float px[2], py[2]; /* pupil xy */
float hx[2], hy[2]; /* headref xy */
float pa[2]; /* pupil size or area */
float gx[2], gy[2]; /* screen gaze xy */
float rx, ry; /* screen pixels per degree (angular resolution) */
UINT16 status; /* tracker status flags */
UINT16 input; /* extra (input word) */
UINT16 buttons; /* button state & changes */
INT16 htype; /* head-tracker data type (0=noe) */
INT16 hdata[8]; /* head-tracker data (not prescaled) */
} FSAMPLE;

My VB6 version of this (which works just fine) looks like this:

Public Type TrackerSample
Ttime As Long
TSampleType As Integer
TFlags As Integer

TPupilX(0 To 1) As Single
TPupilY(0 To 1) As Single
THeadX(0 To 1) As Single
THeadY(0 To 1) As Single
TPupilA(0 To 1) As Single
TGazeX(0 To 1) As Single
TGazeY(0 To 1) As Single
TAngX As Single
TAngY As Single

TStatus As Integer
TInput As Integer
TButtons As Integer

TDataType As Integer
TData(0 To 7) As Integer
End Type

My VB.NET Structure that I'm Trying to use looks like this:

Public Structure TrackerSample
Public Ttime As UInt32
Public TSampleType As Int16
Public TFlags As UInt16

Public TPupilX() As Single
Public TPupilY() As Single
Public THeadX() As Single
Public THeadY() As Single
Public TPupilA() As Single
Public TGazeX() As Single
Public TGazeY() As Single
Public TAngX As Single
Public TAngY As Single

Public TStatus As UInt16
Public TInput As UInt16
Public TButtons As UInt16

Public TDataType As Int16
Public TData() As Int16

Public Sub New(ByVal Dummy As Integer)
Ttime = Convert.ToUInt32(1)
TSampleType = 2
TFlags = Convert.ToUInt16(3)
TAngX = 4
TAngY = 5
TStatus = Convert.ToUInt16(6)
TInput = Convert.ToUInt16(7)
TButtons = Convert.ToUInt16(8)
TDataType = 9
Dim Arr() As Single = {-1.1, -1.1}
Dim Arr8() As Int16 = {2, 2, 2, 2, 2, 2, 2, 2}
ReDim TPupilX(1)
Array.Copy(Arr, TPupilX, 2)
ReDim TPupilY(1)
Array.Copy(Arr, TPupilY, 2)
ReDim THeadX(1)
Array.Copy(Arr, THeadX, 2)
ReDim THeadY(1)
Array.Copy(Arr, THeadY, 2)
ReDim TPupilA(1)
Array.Copy(Arr, TPupilA, 2)
ReDim TGazeX(1)
Array.Copy(Arr, TGazeX, 2)
ReDim TGazeY(1)
Array.Copy(Arr, TGazeY, 2)
ReDim TData(7)
Array.Copy(Arr8, TData, 8)
End Sub
End Structure

I've added the 'New' sub to be able to check on the creation of the structure and it's contents... Now here's the problem:

I create an instance of a TrackerSample and a var to get the return values:

dim MySample as New TrackerSample(0)
dim MyVar as Int16 = -99

When I 'forget' to StartRecording, I correctly get a return value of -1, indicating that there are no samples available. When I do 'StartRecording' (the EyeLink starts tracking correctly!) and call:

MyVar = NewestFloatSample(MySample)

I get an ERROR stating that: "a reference is not pointing to an instance of an object" ... in other words, the system is complaining that I'm feeding it a NULL pointer. In my debugger Watch-window I can however see that MyVar and all members of MySample have the assigned values, therefore they all do exist. Some of the members of MySample are actually changed by the call before the program bangs-out.

WHhat is going on??? I first tried all the type assignments in 'native-VB', using Short instead of INT16 and so on ... No difference... and I've tried an older version of the dll... Same problem..................... HEEEEEEEEEEEEELLLP !

greetz, Peter


 Reply:
by:Mattias Sjögren

 
Add the attribute

<MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)>

to the array elements in TrackerSample.

Mattias



Posted by Xander Zelders
0 Comments



Custom message loop

Found the following interesting discussion in the Newsgroups:

Custom message loop
by:Nak

Hi there,

I am attempting to make a custom message loop in VB.NET so that I can
use it for interprocess communication. At current I am successfully
creating a window class that never actually gets drawn to screen so that I
can recieve messages, this seems to work but for only a few messages then
all of a sudden my application seems to start unloading.

I have a class that exposes shared methods, mainly windows API's and
types, after a couple of messages have been sent to the "windowless" I can
no longer use any of the shared methods as I am being told that the object
is not referenced, I never thought it was??!?

I am wondering if there is anything else that I should be processing in
order to keep this object alive, currently my Windows message handler looks
like so...

-----

Private Function MyWndProc(ByVal hWnd As Integer, ByVal msgvalue As Integer,
ByVal wParam As Integer, ByVal lParam As Integer) As Integer
Dim pIntRetVal As Integer

Select Case msgvalue
Case WM_DESTROY
Call PostQuitMessage(0)
Case Else
RaiseEvent messageRecieved(msgvalue, wParam, lParam)
pIntRetVal = DefWindowProc(hWnd, msgvalue, wParam, lParam)
End Select

Return (pIntRetVal)

End Function

-----

I seem to be able to send about 2 or 3 of my own messages to the window
before it suddenly stops working, maybe it has something to do with
DefWindowProc being called at the wrong time?

If anyone has any suggestions I would be most appreciative. Thanks
loads in advance!!!

Nick.



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

 Hi Nak,

I suggest you create a new thread to do the interprocess communication by
message loop. Because one thread will be associated with one message queue,
if there is something making MyWndProc hang, then all the thread including
the main window's winproc will hang.

Also can you describe your senario more detailed, there may be another
solution.

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.




Posted by Xander Zelders
0 Comments



Newline in a datatable column

Found the following interesting discussion in the Newsgroups:

Newline in a datatable column
by:Raymond Lewallen

I have tried everything to get a newline character into a datatable to no
success.

I'm trying to add the following to a column in a datatable:

sb.append("A")
sb.append(ControlChars.NewLine)
sb.append("B")

when i extract the value of the column after adding, I get "A" instead of
character? I'm trying to bind this to a datagrid where I need multiple
lines in a column on a windows form.

What I have:
Row1 Z Y X A

What I need:
Row1 Z Y X A
B

Thanks for your help.

Raymond Lewallen


 Reply:
by:Anonymous

 It works. Extend height of the row with multiline data in dataGrid and then check again.



Posted by Xander Zelders
0 Comments



Embed dll

Found the following interesting discussion in the Newsgroups:

Embed dll
by:Anonymous

Hi

How do I embed a dll in my project output, so I end up having only one file eg. one exe and still from within my project can access the dll, eg.:

Private instanceofdll as new myclass.specialtype

/SB


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

 

<URL:http://www.gotdotnet.com/community/usersamples/Default.aspx?query=illink>
<URL:http://research.microsoft.com/research/downloads/#ILMerge>

--
Herfried K. Wagner


 Reply:
by:Anonymous

 Thank you for your quick response, in the meantime I'm having som trouble making it work, I have downloaded Ilmerge and tried it out but with no luck. I was hoping you could give me an examble of the syntax where 2 files are to be merged into one. Thanks

/SB



Posted by Xander Zelders
0 Comments



How to show icons in a checked list box?

Found the following interesting discussion in the Newsgroups:

Showing icons in a checked list box
by:Anonymous

Hi!

We have an application that searches Active Directory and returns user and contact lists to a checked list box, ready for selecting....

We would like to show whether the item displayed in the list box is either a user or a contact object by using a small image for each type of object.

Is this possible using the standard check list box control?

If not, does anyone have any idea how to obtain such a control?

Thanks

Phil


 Reply:
by:Jeff Johnson [MVP: VB]

 
No. Try a list view control instead.


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

 

I would use a listview control with 'CheckBoxes' set to 'True' (and
maybe 'View' set to 'Details' and 'FullRowSelect' set to 'True').

--
Herfried K. Wagner


 Reply:
by:Anonymous

 OK, I will try this, but how can I then display the correct image?

Thanks again!

Phil


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

 

Have a look at the listview's '*ImageList' properties and the
'ListViewItem''s 'ImageList' and 'ImageIndex' properties.

--
Herfried K. Wagner



Posted by Xander Zelders
0 Comments



Grabber control ?

Found the following interesting discussion in the Newsgroups:

Grabber control ?
by:Stan Sainte-Rose

Hi,

How to grab a webpage as an Image within vb.net ?
Thanks for your help
Stan


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

 

<URL:http://sourceforge.net/projects/iecapt/>

--
Herfried K. Wagner


 Reply:
by:Nak

 LOL


Maybe I'm missing something.

Nick.


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

 

<URL:http://iecapt.sourceforge.net/>

--
Herfried K. Wagner



Posted by Xander Zelders
0 Comments



Datagrid with grouping

Found the following interesting discussion in the Newsgroups:

Datagrid with grouping
by:Anonymous

hello,
I was wondering if there is anyway that you can implement a datagrid that spreads over two rows based on grouping, so you could have something similar to below.
Description qty type A Type B Type c
Part 1 2 £11.00 £12.00 £13.00
Costs £22.00 £24.00 £26.00
Part 2 2 £60.00 £100.00 £46.00
Costs £120.00 £200.00 £92.00

The number of rows that the datagrid should contain is not determined till runtime.

Any help would be appreciated.

Geraldine


 Reply:
by:Ken Tucker [MVP]

 Hi,

Dont know of any way to do that with the datagrid. Take a look at
the free component one grid that comes with vb.net resource kit. There are
samples that show you how to do grouping.

http://msdn.microsoft.com/vbasic/vbrkit/default.aspx
Ken



Posted by Xander Zelders
0 Comments



How to change Character Entered?

Found the following interesting discussion in the Newsgroups:

Changing Character Entered
by:Ricky W. Hunt

Is there is a way to "change" what character the user typed? For instance,
is there anything I can put in a Keypress handler that if the user pressed
the <Enter> key it make it appear to the program that <Tab> was pressed? I'm
going through some tutorials that has a number validation routine (to ensure
only numbers were pressed, etc.) and it has a check to see if the <Enter>
key was pressed, and if so to set the focus to the next text box. Since
there's a bunch of these text boxes this code has to be copied into then
Keypress handler for each one. A subroutine won't work because the box you
want to transfer focus on depends on which box you are currently in. I
thought if I could make it appear to the program as though the user had
pressed Tab when they pressed Enter the cursor would jump to the correct box
(as set up by Tab order) and therefore I'd have a "universal" subroutine
that could be used for all the boxes.

--
Thanks,
Ricky W. Hunt


 Reply:
by:One Handed Man \( OHM - Terry Burns \)

 Well firstly, there are two ways to handle this situation. You could create
a handler for the first text box and then add more handles statements for
all the others you want this sub to handle ( 1 sub, handles all your txt
boxes. ), or you can set the form to Preview in the properties, and check
the keypress event for the form, this way you will trap all kepress events
and the form previews them before passing them on the handler for the
control that called them.

--

Terry Burns


 Reply:
by:Ricky W. Hunt

 

Yes but how does the one sub know where to put the focus next? It doesn't
seem like I should have to write a Case statement with the sub for each box
just to set focus. Why isn't here some "generic" command that just says "set
focus to the next control according to tab order" or something to that
effect?


 Reply:
by:One Handed Man \( OHM - Terry Burns \)

 Easy . . . In each handler or in the form's keypress with KepPreview to on

Private Sub Form1_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles MyBase.KeyPress
If e.KeyChar = ChrW(Keys.Return) Then
SendKeys.Send("{TAB}")
End If
End Sub
--

Terry Burns



Posted by Xander Zelders
0 Comments



Launch another application and wait for it to complete.

Found the following interesting discussion in the Newsgroups:

Launch another application and wait for it to complete.
by:Shelby

Hi,
if I launch another application in my vb code, how can I wait for it to
complete first?

Dim myProcess As Process
myProcess = New Process
myProcess.Start("test.exe")
' I want to wait for test to complete and continue with other codes
myProcess = Nothing

Thanks
Shelby


 Reply:
by:Tom Shelton

 On Wed, 7 Jul 2004 13:18:36 +0800, Shelby wrote:


myProcess.WaitForExit()

--
Tom Shelton


 Reply:
by:Shelby

 Hi Tom,
it raise an error:
An unhandled exception of type 'System.InvalidOperationException' occurred
in system.dll
Additional information: No process is associated with this object.


 Reply:
by:Ken Tucker [MVP]

 Shelby,

You are calling waitforexit before you dispose of it? Try this.

Dim p As Process = Process.Start("Notepad.exe")

p.WaitForExit()

p = Nothing

Ken


 Reply:
by:Shelby

 Hi Ken,
thanks for that..

Shelby



Posted by Xander Zelders
0 Comments



Launch another application and wait for it to complete.

Found the following interesting discussion in the Newsgroups:

Launch another application and wait for it to complete.
by:Shelby

Hi,
if I launch another application in my vb code, how can I wait for it to
complete first?

Dim myProcess As Process
myProcess = New Process
myProcess.Start("test.exe")
' I want to wait for test to complete and continue with other codes
myProcess = Nothing

Thanks
Shelby


 Reply:
by:Tom Shelton

 On Wed, 7 Jul 2004 13:18:36 +0800, Shelby wrote:


myProcess.WaitForExit()

--
Tom Shelton


 Reply:
by:Shelby

 Hi Tom,
it raise an error:
An unhandled exception of type 'System.InvalidOperationException' occurred
in system.dll
Additional information: No process is associated with this object.


 Reply:
by:Ken Tucker [MVP]

 Shelby,

You are calling waitforexit before you dispose of it? Try this.

Dim p As Process = Process.Start("Notepad.exe")

p.WaitForExit()

p = Nothing

Ken


 Reply:
by:Shelby

 Hi Ken,
thanks for that..

Shelby



Posted by Xander Zelders
0 Comments



How to get Windows Directory?

Found the following interesting discussion in the Newsgroups:

How to get Windows Directory?
by:Shelby

Hi,
is there a better way to get the Windows directory?
I manage to get the system directory with :
System.Environment.SystemDirectory

So I was wondering how do I get the Windows directory?



 Reply:
by:Ken Tucker [MVP]

 Hi,

Trace.WriteLine(Environment.GetEnvironmentVariable("WINDIR"))

Ken


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

 

System directory:

'Environment.GetFolderPath(Environment.SpecialFolder.System))'

Windows directory:

'System.Environment.ExpandEnvironmentVariables("%WinDir%")'

- or -

Trick by Bill McCarthy:

'System.Environment.GetFolderPath(CType(&H24, System.Environment.SpecialFolder))'

- or -

P/invoke on 'GetWindowsDirectory' (IMO the preferred way):

<URL:http://groups.google.de/groups?selm=%23pJhic2CBHA.2200%40tkmsftngp07>

--
Herfried K. Wagner


 Reply:
by:Shelby

 Hi,

thanks for that.
By the way, can I get IIS root folder with that too?



Posted by Xander Zelders
0 Comments



Closing MDI Child Form

Found the following interesting discussion in the Newsgroups:

Closing MDI Child Form
by:Anonymous

When I open and close an mdi child form six times, I get a system out of memory error.

Is there a way to better manage memory when closing a form?


 Reply:
by:Anonymous

 I resolved this by removing a call to a separate thread from the load event for the form. I have no clue why calling a separate thread would cause the form to only be able to be opened six times, but the issue is resolved.





Posted by Xander Zelders
0 Comments



Anyone with VB .NET 2003, please help!

Found the following interesting discussion in the Newsgroups:

Anyone with VB .NET 2003, please help!
by:unkn0wn0rigin@yahoo.com (A.S.)

I have this code here that I wrote with the Visual Basic 2005 Express
Edition Beta. However, I can't use the executable on other computers
because it was compiled to use the .NET Framework 2 Beta. Could
someone please compile this to use the .NET Framework 1.1? Heck, I
don't even know if it's possible. I'm a VB newbie.
Module Main

Sub Main(ByVal files() As String)

Try

Dim vector As Object = CreateObject("WIA.Vector")

For Each file As String In files
vector.Add(file)
Next

Dim dialog As Object = CreateObject("WIA.CommonDialog")
dialog.ShowPhotoPrintingWizard(vector)

Catch e As Exception

End Try

End Sub

End Module


 Reply:
by:mohamed.mossad@egdsc.microsoft.com (Mohamoss)

  Hi
You can just get framework 1.1 and compile your code against it yourself.
Checkout these links

http://msdn.microsoft.com/netframework/technologyinfo/howtoget/default.aspx
http://www.microsoft.com/downloads/details.aspx?FamilyId=262D25E3-F589-4842-
8157-034D1E7CF3A3&displaylang=en
You might need to do some modifications to your code however , hope this
helps
Mohamed Mahfouz



Posted by Xander Zelders
0 Comments



Write to a file in a dll

Found the following interesting discussion in the Newsgroups:

Write to a file in a dll
by:WStoreyII

Is There anyway to write to a file in a dll.

Like lets say i packaged an xml file called customers as a resource in a dll
is there any way that i could write to and or append the changes to it so
that it will be secure inside the dll for security purposes?

WStoryeII


 Reply:
by:Ray Cassick \(Home\)

 Self modifying code is not a trivial thing at any pace, but I would expect
that it comes a bit more difficult in the managed code arena.

Why not juts look into the new managed technologies of serialized objects
and cryptography. I wrote a bit of code that writes a class out to a file
that is encrypted with DES using a binary formatter and it only took me
about 2 hours using example code I found on the internet.

Of course I would then recommend that you obfuscate the code to hide your
keys and protect your entire assembly used to access your file, but that is
really the trivial part of it.


 Reply:
by:Anonymous

 so then there is now way to write to a file that is inside of a dll?




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

 WStoreyII,
I'm not sure how having the XML in a DLL is secure. Its easy enough to read
an embedded resource from an assembly...

I would think having the XML encrypted, using the
System.Security.Cryptography.CryptoStream class would be significantly more
secure.

The only way I know of to write to a file in a dll, is to use one of the
compilers and recompile your assembly, or use al.exe to embed a resource.
Unfortunately you will need to be certain that the assembly was not loaded
(effectively has no code). I don't remember if al.exe is part of the .NET
SDK or the runtime.

Hope this helps
Jay



Posted by Xander Zelders
0 Comments



Pass variables to another program

Found the following interesting discussion in the Newsgroups:

Pass variables to another program
by:Seb Schöps

Hi everyone,

how can I exchange variables between 2 .exe files? I will write both of
them, but I can't find a way to exchange data between the two.

Thanks for any help!

Regards
Sebastian


 Reply:
by:AlexS

 Seb

take a look at http://support.microsoft.com/default.aspx?scid=kb;en-us;95900
It gives a pretty good summary of what is available.

HTH
Alex


 Reply:
by:Samuel L Matzen

 Seb,

I did a project using Named Pipes a coule of years ago and it worked great.

-Sam Matzen



Posted by Xander Zelders
0 Comments



Compile options

Found the following interesting discussion in the Newsgroups:

compile options
by:William

I read somewhere that VB.net can exclude code from the release configuration
that was only used for testing during the development stage. If I remember
correctly it went something like:

#if debug
'code that you do not want in release compile goes
'here
#end if

but my head is filled with so many other things that I am learning in order
to make the switch from vb6 to Net that I can't remember. Can someone point
me in the right direction.

Thanks


 Reply:
by:Richard Myers

 Hi William ,

Your asking about a really flexible part of the complier with a ton of
alternative examples and uses so im not going to bother getting into it
here.

So check out the docs under the terms:


hth
Richard


 Reply:
by:William

 Thank you very much Richard


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

 

\\#If DEBUG Then
...
#End If
///

Remember that you can get information about a language element by
placing the caret on it and pressing the F1 key (assuming help is
installed locally).

--
Herfried K. Wagner



Posted by Xander Zelders
0 Comments



Slow to load apsx pages developed in VB.NET

Found the following interesting discussion in the Newsgroups:

Slow to load apsx pages developed in VB.NET
by:Anonymous

Hello,

I am able to load an aspx file ok but then when i start to fill out the form and click on a new form button, the pages takes too long to load. I am using Windows 2000 server with service pack 4 and IE 6. Anybody knows what is the culprit? Also I can ping the server machine fine but from the server machine i cannot ping the machine trying to run the web application. How can I fix this connection problem?


 Reply:
by:Samuel L Matzen

 AL,

What do you have on the form?

When the page displays on the browser view the source, mark all, copy and
paste to a text editor where you can see how big the total payload is. If
it is over about 400k you have a payload size problem.

Are you using third party controls that require a large jScript file to be
loaded down to the browser?

-Sam Matzen

form and click on a new form button, the pages takes too long to load. I am
using Windows 2000 server with service pack 4 and IE 6. Anybody knows what
is the culprit? Also I can ping the server machine fine but from the server
machine i cannot ping the machine trying to run the web application. How can
I fix this connection problem?


 Reply:
by:Richard Myers

 Check out microsoft.public.dotNet.framework.aspnet group.

If your running thru the net it could be anything.... if your running just
on a LAN in a development environment, i'd start with simple things like
ensuring your Firewall is off/proxies stuff like that.... if you can ping
the server from the client but not the client from the server then these
could be some likely culprits.

Either way wrong newsgroup.

Richard


 Reply:
by:One Handed Man \( OHM - Terry Burns \)

 Whats the size of your viewstate ?, in some cases this can run into
megabytes

--

Terry Burns



Posted by Xander Zelders
0 Comments



OT - Book about software project definitions and the pre-coding phase

Found the following interesting discussion in the Newsgroups:

OT - Book about software project definitions and the pre-coding phase
by:Josh Golden

i lead a small development team (based on some of my posts that might cause
some people to choke themselves, but have no fear, i am NOT the lead
developer, the people on my team are great - i'm just the manager) for my
company. although we attempt to use good practices for development, we have
no real experience in documentation of a project _before_ it's coded.

Are there any great books out there on how to document a project before we
code. For example, i actually hear that some people write classes off of a
master document that lists all properties, methods, events, etc. We
basically just survive on notes, meetings, and the "code like hell"
methodology - which will kill us in the long run.

I have some great books on management, like the mythical man-month and
others, but I am interested in a book on documenting a software project
before the coding starts.

Thanks



 Reply:
by:Richard Myers

 Hi Josh,

I appreciate that you have recognised your "problem" and have the energy and
committment to undertake further training to attempt to resolve it... but
are you serious?

Flag the books.... just go buy the skillset you need. Sack/demote your "lead
developer" if you have too in order to afford an SA. He/she is just an
imposter if they are prepared to lead a team with no solid architecture.


You need to identify a suitable methodology such as UML, and work from
there, but that will obviously require your "team" to learn the methodology
as well.

If you've "grown" the team into this situation then congratulations are in
order... but do yourself a favour and get the right people with the proper
skills doing the right job, right now. Dont diddle about with books as a
cheap substitute for a flesh and blood professional.

Software projects are like children, they require different people with
different skillsets at different stages of their lives, otherwise they tend
to grow up with all kinds of weird and wonderful disorders that make it
really hard for them to play well with others and make their own ways in the
world.

If all this sounds a bit harsh then dismiss it, after all its your future
not mine..... and the smart arse within me is saying "Thank God"!

;)

hth
Richard


 Reply:
by:Josh Golden

 Richard, I appreciate the honesty of your post but you have to understand
where we're coming from. i'm not some great programmer who has 2 degrees in
technology. like many others, i drifted to IT after making some wrong life
choices (that's my assessment) and i'm here because i really like the stuff.
i'm a great dba but a mediocre application coder. i've been at this company
for a while and had the ability to hire some young people who also like to
code and collectively we make good stuff.

perhaps you're right that i don't need a documentation book, i need a uml
book. i can't take a week off to attend a class so i gravitate towards
books because i can read them in the car (not while driving), plane, beach,
bed, etc. what everyone in my group needs, scratch that, needed was to work
a year for some big company that has big documented projects so we could see
how it's done but we didn't. we're just collectively good software people
who missed some fundamentals and now at least have the smarts to recognize
that we want to do it better. i don't want to fire anyone.

thanks for your help on my datatable/dataset post too.

J


 Reply:
by:Richard Myers

 Yeah well fair enough.

Sometimes i do get a little fired up. Somone once said to me to lay off the
caffine. Perhaps they were right but i can type soooo much faster after a
couple of cans of Redbull. Please tell when i'm full of sh*t. I like to
learn too.

;)

The Visio has some impressive UML support built in, i remember watching a
dotNet show webcast on it.
It all seemed very worthwhile, a high level of integration between
VS/Visio/DAL/ and very accessible to the developer. The advantage here would
be you could "wizard" your team thru much of the initial learning curve and
gradually bring everyone up to speed.

If you do nothing else, you can move everyone from their own little note
taking stash, to a centralized model, that serves as an objective point of
reference. I realise there is always a gap between the theoretical text book
reality but i reckon it's false economy to skip the foundational steps of a
software development project.

If it's a really small team say 5 or less and you're all competent
communicators then i'm sure you can get away with it, but if your products
are great now, think of the opportunity cost in that they could have been
outstanding with an architect on board/consulting.

I stand by my original suggestion in that someone has to take responsibility
for this very important phase of development. If you cant take a week
off.... then someone should... bank a week tomorrow and save yourself a
month later.

I assumed you were talking about architectural documentation? Are you
building applications/class libraries/components/?

Richard


 Reply:
by:Ray Cassick \(Home\)

 The problem here as I see it is kind of a catch-22 situation. At least you
have recognized that you have a problem and that is the first step.

The real problem is that, while there are many design paradigms available
that you can adopt, no one here can tell you which ones are the best, or
which one fits your situation better than you can. Unfortunately this takes
some time to research for yourself. Simply adopting A development process
for the sake of adopting ONE is not really a good thing IMHO.

This entire subject is something that many people can get very 'religious'
sounding about simply because there are so many people with opinions. Myself
included.

I started a very small software company (3 developers) that struggled with
this same issue. I simply don't have the cash, nor the time to invest in
supporting something like RUP (Rational Unified Process) simply because I
don't have the money to invest in the tools it takes. I would love an
end-to-end solution to be dropped right into my lap, but quite frankly I
understand that if one was dropped at my feet it would probably not fit 'my
needs' as a developer. It would be something cookie-cutter that some one was
pushing as the next best 'thing'.

If it helps at all, here is what I did (am doing):

0) MAKE the time to set up your processes. You might think that you have
to take time away from coding to do this but you don't. Of course you CAN,
but you don't have to. It all depends on how important this is to you. If
you can't commit to taking time away from doing your projects then simply
say that you will add to your work load by adding additional time to your
day after coding to tackle the project. Hard times call for hard work and
hard decisions. This is something my wife learned long ago when I started my
personal venture.

1) Decide that you NEED a process. But also understand fully how you
would benefit from it and also what you WANT from it. Unless you see the
benefit down the line you will eventually start to not follow it and then
the entire exercise is a waste of time. Write down a set of goals that you
want to achieve and then build your own process around those goals.

2) READ about what is out there. Since you are not alone don't think that
you have to do this alone. Delegate the research to your other workers to
study fro one week, each on a different paradigm that is available (how it
works, the tools used in it, the processes, etc..) and present this to the
rest of the group. If nothing else you will be better able to see what is
already out there, what you like and don't like about each paradigm and if
you can take this from here and that from there and evolve your own.

Here are a few that I researched:

RUP
http://www-306.ibm.com/software/awdtools/rup/features/index.html

SCRUM
http://www.controlchaos.com/scrumwp.htm

XP
http://www.extremeprogramming.org/

There are many more, I could not possibly list them all here. There is a
sizable amount of overlap among them and some very definite differences as
well.

3) MAKE the first move. Start small, don't bite off more than you can
chew on. Just like the old adage "how do you eat an elephant" the answer is
one bite at a time my friend. What I did was pick one pet peeve that was
always making me nuts, code conventions. Variable naming, stuff like that
always ends up being just a bit different between developers. DOCUMENT it
down to the smallest detail. Get everyone together and agree on what will be
the company 'Best Practice' for code conventions. Then, here is the really
hard part.. FOLLOW it. Start holding code reviews and make people follow the
spec that was agreed on. Trust me when I say that starting here begins to
snowball. Once you start to realize that having this documented frees you
from having to worry about it in the back of your head a light bulb will go
on and you will start to document other things.

4) Develop a standard document format. I have seen companies argue over
the dumbest things and this has been one of them. If you have to put your
foot down as a leader and simply say 'this is the format that I have decide
we will use for all our standards documents' then so be it. But also
understand that you have to be open to change. You are not all knowing so if
someone has an idea that is good, adopt it and move on.

5) Just like using version control for code (you do use version control
for code right?) you should version control your documented processes. They
will evolve and it is always good to track that evolution incase suddenly
you see something not work and you need to go back a bit and make changes.

6) Document everything. Process documentation for a software company does
not just mean documenting software procedures. You have to effectively
communicate between yourselves and also effectively document that
communication. Start keeping meeting minutes, tracking how attends, when it
was, how long it was, what actions who took out of each meeting. This keeps
your mind looking towards process management as a whole and not just
software process management.

..
..
..
..

Boy I went off on a rant here didn't I.... Well it is as I said.. a
sometimes religious type discussion.

I hope that I have helped a bit.

If you are looking to get some ideas about the actual TYPES of documents
used I might be willing to share some of the formats and stuff off line with
you.



Posted by Xander Zelders
0 Comments



o cimeru

Found the following interesting discussion in the Newsgroups:

o cimeru
by:DzemoT.

nesto sumnjam da cu doci danas al et nesto sam konto o onim Pocket PC sto
trebamo dobiti. Haj otidji i vidi na http://www.gsmarena.com/idx.php3 MPx100
I MPx200 sta mislis moze li to posluziti i da nam to nabavi?


 Reply:
by:Jeff Johnson [MVP: VB]

 

MPx100

I was about to ask if this was Romanian when I saw the .ba in the email
address. Bosnia-Herzegovina.


 Reply:
by:Klaus H. Probst

 
sto

I lost him at "doci" myself.

--
klaus


 Reply:
by:Jeff Johnson

 
Why Klaus, I thought you had written off VB!


 Reply:
by:Klaus H. Probst

 Who me? <g>
--
klaus



Posted by Xander Zelders
0 Comments



Overload failed - no 'new' available

Found the following interesting discussion in the Newsgroups:

overload failed - no 'new' available
by:Josh Golden

i have a solution with 2 projects in it, project a and b. project a will be
a dll, but for now exists in the solution. projectB references projectA.
projectA has a dataset with one datatable in it, dataTable1.

From within projectA, in any class or method I have

private x as new ProjectA.dataTable1 -- and this works fine.

but in projectB, when I type
Private y as new ProjectA.dataTable1 -- I get the message
Overload resolution failed because no 'New' is accessible.

I don't get it. I have the right imports, references, etc.

what could it be?




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

 Josh,
Is the Sub New of dataTable1 declare as Public?

It sounds like you made Sub New "Friend" in dataTable.

' this will fail in projectB
Public Class dataTable1

Friend Sub New()
End Sub

End Class

' this will succeed in projectB
Public Class dataTable1

Public Sub New()
End Sub

End Class

Hope this helps
Jay


 Reply:
by:Josh Golden

 That sounds possible, I'm never sure when to use friend, but how could I
have done that? I added the dataset and the datatable through the gui.
LIke Project - Add New Item - DataSet. then i double-clicked it and hand
entered the datatable. how is it then set as friend? it looks to be an
xsd?

Josh

Jay B. Harlow


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

 Josh,
How's that go "That's a horse of a different color".

VS.NET 2002 or VS.NET 2003?

Using VS.NET 2003 I do not see the behavior you are experiencing.

I do however need to prefix table names with the dataset name, in both
projects:


private x as New ProjectA.DataSet1.DataTable1

In ProjectA, the ProjectA is optional.

You didn't name the DataSet the same as your Project did you?

I started naming my DataSets something like "InvoiceDataSet" to avoid

Hope this helps
Jay


 Reply:
by:Richard Myers

 Hi Josh,

Use Friend to scope an object when you only want that object to be visible
to other objects from the same assembly. You do this to prevent other
objects from another assembly from creating instances of classses when they
shouldn't. This also allows a cleaner namespace and clearly signals to other
developers how that assembly and the classes within it are supposed to be
used.

The designer automatically sets the Scope of a dataset encapsulated table to
Friend. If you look at the .vb for your dataset, by expanding the XSD File>
..Vb File, and scroll through the designers code you'll see your datatable is
scoped at Friend. Hence the reason you cannot see it from another assembly.

Your design sounds a little bung. If you just want a datatable then inherit
from it, instead of creating a dataset and then not using it.

Public MyTable
inherits Datatable

......

If you need to access the table and dont wish to directly inherit from
Datatable then you should be dimming up an instance of your Project A
dataset, not datatable, in project B.

dim ds as new dsWithTheTableIwanttoUseInIt()
ds.Table1(2).MyColumn="Blah Blah"
hth
Richard



Posted by Xander Zelders
0 Comments



Autocad Question

Found the following interesting discussion in the Newsgroups:

Autocad Question
by:john m

Hello,

I downloaded the beta vb8 express thing and since installing it none of
my AUTOCAD vba routines work anymore.

I tried the AcadVBA newsgroup but no one else seems to have had this. My
operating system is called Windows 2000 "Professional"

Should i Re-install ACAD? Uninstall Dot Net?

Can anyone help?

Thanks

jm


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

 

Error message?

I suggest to report that in Product Feedback Center:

<URL:http://lab.msdn.microsoft.com/productfeedback/>

--
Herfried K. Wagner


 Reply:
by:john m

 Thank you HK

the error message for most programs is "run time error (some number)"
then "Catastrophic Failure"

but there is one routine which simply inserts a block in autocad
it gets "run time error (some number)"
then "No Database"

I guess it means the Autocad database since it has nothing to do with any
database

JM



Posted by Xander Zelders
0 Comments



Email attachements in vb .net

Found the following interesting discussion in the Newsgroups:

email attachements in vb .net
by:Bernie Yaeger

I know how to attach a document to an email inside vb .net with
msg.attachments.add("c:\ppp.txt")

However, is there a way to attach files via wildcards - eg, c:\p*.txt to get
c:\ppp.txt and c:\ppw.txt? I tried it directly but got an unrecognized cast
error.

Thanks for any help.

Bernie Yaeger


 Reply:
by:Bernie Yaeger

 figured out a way - just looping with dirinfo and attaching only those that
meet the spec.

Tx

Bernie


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

 

\\For Each s As String In Directory.GetFiles("C:\p*.txt")
...
Next s
///

--
Herfried K. Wagner


 Reply:
by:Bernie Yaeger

 Tx Herfried - as usual, your solution was more elegant than mine!

Bernie



Posted by Xander Zelders
0 Comments



Visually Design Windows Forms Controls

Found the following interesting discussion in the Newsgroups:

Visually Design Windows Forms Controls
by:gwhubert@hotmail.com (Gene Hubert)

Is there a way to Visually Design Windows Forms Controls?

For example, I have a class that inherits TextBox. Can I see a
property sheet and a rendition of what it will look like as I develop
it?

It seems that this functionality is limited to Windows Forms.

I've got Standard Edition and thought it might me a limitation of
that.

I know I can put the control on a form and see it that way but that's
not what I had in mind.

Thanks,
Gene H.


 Reply:
by:Samuel L Matzen

 Gene,

That is what UserControls are for.

-Sam Matzen


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

 

When inheriting from an existing Windows Forms control (except
'UserControl'), you won't have a graphical designer. You can add a test
form and instantiate the control on it to test the control.

--
Herfried K. Wagner



Posted by Xander Zelders
0 Comments



Round button?

Found the following interesting discussion in the Newsgroups:

round button?
by:DzemoT.

how to make round button in vb.net?


 Reply:
by:Dan Watson

 DzemoT. wrote:


draw a grey circle and add a _click event

:D


 Reply:
by:One Handed Man \( OHM - Terry Burns \)

 Thats a bit basic, but yes. thats one way. Another way is to create a custom
control.

--

Terry Burns


 Reply:
by:Ken Tucker [MVP]

 Hi,

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

http://www.thecodeproject.com/vb/net/CnControls.asp

Ken


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

 

C# sample:

<URL:http://www.codeproject.com/cs/miscctrl/RoundButton_csharp.asp>

--
Herfried K. Wagner



Posted by Xander Zelders
0 Comments



dll not found

Found the following interesting discussion in the Newsgroups:

dll not found
by:Frank

Hello,
I have usercontrol dll. If I reference it in the calling application with
local copy=true it works fine. If I set local copy to false. I get an error
saying the dll cannot be found. What do I have to set to ensure the dll in
the bin of the usercontrol is used?
The reference path in the projectproperties refers to that bin. Someplace
else I have to set something?
Thanks
Frank



 Reply:
by:Tom Spink

 Hi, may I ask why you need to set local copy to false? If the usercontrol
DLL is recompiled, then the new version of the DLL is copied to your
application directory... if that's what you're worrying about.

--
HTH,
-- Tom Spink


 Reply:
by:Frank

 Thanks, I didn't know/noticed and it solves my problem. But....it doesn't
answer the question, why is the dll not found?
Frank


 Reply:
by:John-Michael O'Brien

 Any supporting DLL that is not in your path, your current directory, or the
application directory will not be found (Since it doesn't know where to look
when it goes to do the runtime bind.) Local Copy copies the file into your
program's application directory. Since your DLL isn't in any of the folders
listed otherwise, the usercontrol file can't be found. Remember, there's no
class registry like there was in ActiveX to look it up in, (Which most
consider a good thing as it solves the DLL hell problem and allows for
side-by-side multiple version support.)

If you where to move your user control to, say, your system32 (on NT
systems) folder, you would no longer receive the error, but would have to
move it there every time you recompiled the user control, and would loose
side-by-side multi-versioning, so usually Local Copy is the method of
choice.

Hope that answers your question. ^.^

--

Signed,
John-Michael O'Brien


 Reply:
by:Frank

 Yes, thanks JM,
but is there is way to change the path inside/during my VB session. So while
developing Appl A have the active path for ApplA also point to the bin of
appl B. Where/how is that path created?
Thanks
Frank



Posted by Xander Zelders
0 Comments



Inheriting from Base Classes (Public Interfaces)

Found the following interesting discussion in the Newsgroups:

Inheriting from Base Classes (Public Interfaces)
by:Charles Law

I have a base class - ComponentBase - that inherits from UserControl. My
class implements IComponentBase, which defines a minimal set of core
properties and methods. All my other components inherit from ComponentBase.

I have defined IComponentBase in a common assembly so that my other projects
reference this rather than the (large) library that contains the component
implementation.

[Stop me when I start to go off the rails]

Now, because UserControl is actually at the heart (base) of all my
components, I automatically get properties like Width, Height, Left, Top,
etc. I also get events like LocationChanged, MouseEnter, and so on.

So that I can attach to the MouseEnter event, and others, I find that I have
to define a MouseEnter event in my interface, implement it in my base class,
and override OnMouseEnter in by base class to call MyBase.OnMouseEnter and
raise my event, which shadows the one in UserControl. It seems that I have
to do this for every event I want to attach to.

I also find that if I want to refer to the Width property of UserControl, I
have to define it in my interface and override it in my base class.

This seems like a lot of code that, basically, just passes things on to the
UserControl base class, and it is very tedious and, of course, error prone.

Am I going about this the right way, or is there an easier solution?

TIA

Charles


 Reply:
by:One Handed Man \( OHM - Terry Burns \)

 Doesent sound too maintainable to me. It also sounds like hard work, Im
simply too lazy, if it was giving me performance problems, I would probably
specify faster computers.

I know thats not the answer you were expecting. Good Luck !

--

Terry Burns


 Reply:
by:Charles Law

 Aaarrgh! }-:-|-[



Posted by Xander Zelders