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

 
Combo Box (Wednesday, October 20, 2004)

Found the following interesting discussion in the Newsgroups:

Combo Box
by:MadCrazyNewbie

Hey group,

Is there a way for a ComboBox to display nothing untill someone clicks on
the drop down button?

My ComboBox is bound to a Datasource and displays the first Item before
anyone clicks on the DropDown button? If you get what I mean?

Ta
MCN


 Reply:
by:William Ryan eMVP

 Set the comboBox's .Text property to string.Empty;


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

 

Set its 'SelectedIndex' prperty to -1.


Set it to -1 /twice/.

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


 Reply:
by:MadCrazyNewbie

 Where do I find the SelectedIndex Property, i may be blind but i carn`t seem
to find it in the propertys:(

thanks
MCN



Posted by Xander Zelders
0 Comments



Marshalling for C struct with arrays

Found the following interesting discussion in the Newsgroups:

Marshalling for C struct with arrays
by:fury74@gmx.net (Markus Stiller)

Could someone give me an hint?

I have trouble with mashaling of a struct. I can set values in struct
(byVAL) but cant read from the struct. Its an long pointer struct in a
c dll.

thats my struct where is correct i guess


'-----------------------------------
' structure declarations
' xl event
<StructLayout(LayoutKind.Sequential, Pack:=1)> Structure s_xlEvent
Public tag As Byte
Public chanIndex As Byte
Public transID As Short
Public porthandle As Short
Public reserved As Short
Public timestamp As UInt64
<FieldOffset(0)> Public tagdata_can_msg As s_xl_can_msg
<FieldOffset(0)> Public tagdata_chipstate As s_xl_chipstate
<FieldOffset(0)> Public tagdata_lin_msg As s_xl_lin_msg_api
<FieldOffset(0)> Public tagdata_sync_pulse As s_xl_sync_pulse
<FieldOffset(0)> Public tagdata_daio_data As s_xl_daio_data
<FieldOffset(0)> Public tagdata_transceiver As
s_xl_transceiver
End Structure
Structure s_xl_can_msg
Public id As UInt32
Public flags As Short
Public dlc As Short
Public res1 As UInt64
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=8)> Public
data As Byte()
Public res2 As UInt64
End Structure
' function to fill/set struct with array - this is successful

Public Declare Function xlCanTransmit Lib "vxlapi.dll" (ByVal
PortHandle As UInt32, ByVal accessmask As UInt64, ByRef messageCount
As UInt16, <MarshalAs(UnmanagedType.LPArray)> ByVal pMessages As
s_xlEvent()) As Byte

' function to read frome struct with array - this is the problem

Public Declare Function xlReceive Lib "vxlapi.dll" (ByVal PortHandle
As UInt32, ByRef pEventCount As UInt16,
<MarshalAs(UnmanagedType.LPArray)> ByRef pMessages As s_xlEvent()) As
Byte

Problem SizeParamIndex is not allowed to with byref parameter :(
Any suggestions?


 Reply:
by:Mattias Sjögren

 Markus,

What does the original native function signature look like? Are you
sure that pMessages should be ByRef in the xlReceive function?

Mattias


 Reply:
by:fury74@gmx.net (Markus Stiller)

 the original function is that. The driver dll I ask is an c dll and
will give me a pointer back to this structure. I saw that the call is
successful and values are returned in the debug messages of dll.

#ifdef DYNAMIC_XLDRIVER_DLL
typedef XLstatus (_EXPORT_API *XLRECEIVE) (
XLportHandle portHandle,
unsigned int *pEventCount,
XLevent *pEvents);
#else
XLstatus _EXPORT_DECL xlReceive(
XLportHandle portHandle,
unsigned int *pEventCount,
XLevent *pEvents);
#endif

Markus


 Reply:
by:Mattias Sjögren

 Markus,

Looks like the array should be passed ByVal after all. Try this

Public Declare Function xlReceive Lib "vxlapi.dll" (ByVal PortHandle
As UInt32, ByRef pEventCount As UInt16, <Out> ByVal pMessages As
s_xlEvent()) As Byte

Mattias



Posted by Xander Zelders
0 Comments



Highlight a single cell on a datagrid.

Found the following interesting discussion in the Newsgroups:

Highlight a single cell on a datagrid.
by:Anonymous

Hello,
I have a datagrid, called MyDataGrid and I wish to put the focus on a particular cell in order that the user to highlight the fact that the user needs to enter a value in this cell, e.g. I put the message up "Please enter an order number" I then wish to highlight the column MyDataGrid(0,1), but I can't find out how to do this.

Many thanx in advance.

Geri


 Reply:
by:Ken Tucker [MVP]

 Hi,

Dim dgc As DataGridCell
dgc.RowNumber = 1
dgc.ColumnNumber = 1

DataGrid1.CurrentCell = dgc

Ken


 Reply:
by:Anonymous

 Thanx Ken,

you're a star

Geri x



Posted by Xander Zelders
0 Comments



MenuItem Mouse Pointer Coordinates

Found the following interesting discussion in the Newsgroups:

MenuItem Mouse Pointer Coordintes
by:Tom

Hi

I am trying to get the exact mouse coordinates as it moves over a
single menuitem on a context menu. As the menu item is not a control i
cannot find any way od doing this.

Any ideas?

Thanks

Tom


 Reply:
by:Jorge

 Hi Tom
The following displays a context menu over a datagrid1.

point = Me.DataGrid1.PointToClient(Cursor.Position)
Me.ContextMenu1.Show(Me.DataGrid1, point)

Kind Regards
Jorge


 Reply:
by:yEaH rIgHt

 Try this:

Private Structure POINTAPI
Public x As Integer
Public y As Integer
End Structure
Dim pt As POINTAPI

Private Declare Function GetCursorPos Lib "user32" (ByRef lpPoint As
POINTAPI) As Integer

Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
GetCursorPos(pt)
Debug.WriteLine(pt.x)
Debug.WriteLine(pt.y)
End Sub



 Reply:
by:Tom

 Thanks,

I have added this code to my inherited MenuItem component, and enabled
the timer. However the timer click event is not getting fired. Have
you any ideas on where i have screwed up?

Cheers

Tom



Posted by Xander Zelders
0 Comments



Using Messenger Popup to display local app alert

Found the following interesting discussion in the Newsgroups:

Using Messenger Popup to display local app alert
by:MC

Hi,
I want to use MS Messenger in order to show an alert on my local PC from my
VB.NET app (I don't want to use the Microsoft Alerts SDK, just de MS Alert
Popup window)

I think this is possible, because the Microsoft Alerts Preview Tool does it.
I just want to know how can I emulate that behaviour.

Thanks in advance.
-- MC


 Reply:
by:Ken Tucker [MVP]

 Hi,

http://www.codeproject.com/cs/miscctrl/taskbarnotifier.asp

Ken



Posted by Xander Zelders
0 Comments



Referencing controls on an EXISTING instance of form

Found the following interesting discussion in the Newsgroups:

Referencing controls on an EXISTING instance of form
by:Paul Bromley

Please help with this one - I have scoured the newsgroups for information on
this, and all of the responses relate to how to refernce controls on a NEW
instanc of a form and not an exitsing one. I wish to access controls on an
EXISTING instance of my form from a module.

I have found one suggestion mentioned twice that works well - is this a
corect way of achieving this aim, or is there a neater alternative:-

The answer that I have found is to create a module with a Sub Main in it and
set this as the Startup Object:-

Module Startup
Public myMainForm As Form1
Sub Main()
myMainForm = New Form1
Windows.forms.Application.Run(myMainform)
End Sub
End Module

As I say - this works well, but is there a better way of doing this??

Many thanks
Paul Bromley


 Reply:
by:Armin Zingler

 

Yes. If you want to access an object, pass the reference to the object that
needs the reference. This is the case for all other types of objects, so I
don't see the difference to Forms.
--
Armin



Posted by Xander Zelders
0 Comments



Ini Files

Found the following interesting discussion in the Newsgroups:

Ini Files
by:MadCrazyNewbie

Hey Again Group,

Anybody got any links for using Ini files within projects?

Many Thanks
MCN


 Reply:
by:Éric Moreau

 See http://www.utmag.com/May2003/Page59.asp

--

HTH


 Reply:
by:Ken Tucker [MVP]

 Hi,

http://www.mentalis.org/soft/class.qpx?id=6

Ken


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

 

In addition to the other posts: If you don't need compatibility with
old-style INI files, use XML files instead:

Configuration Management Application Block
<URL:http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/cmab.asp>

<URL:http://www.palmbytes.de/content/dotnetlibs/optionslib.htm>

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



Posted by Xander Zelders
0 Comments



Loop Treeview Nodes

Found the following interesting discussion in the Newsgroups:

Loop Treeview Nodes
by:Anonymous

Hi,

Can anybody show me how to loop all treeview nodes ini vb.net. I've been working on this for days but still no result.
I got a sample code in vb 6.0, this one works.

Private Sub SaveNested()
Dim TNode As Node
Set TNode = TreeView1.Nodes(1).Root

While Not TNode Is Nothing
If TNode.children > 0 Then
AddChildNodes(TNode)
End If
Set TNode = TNode.Next
Wend
End Sub

Private Sub AddChildNodes(ByVal TNode As Node)
Dim childNode As Node
Dim i As Integer
Set childNode = TNode.Child

For i = 0 To TNode.children - 1
If childNode.children > 0 Then
AddChildNodes(childNode)
End If
Set childNode = childNode.Next
Next
End Sub

I tried to rewrite the code in vb.net, but then stuck in using treeview(.net) properties. Could advice me how to write this in vb.net.
Thanks
Yanto



 Reply:
by:EricJ

 
i am working w the infragistics tree but it should be the same
and i'm not rally sure this is wat you want (a loop not doing anithing
special?)

private sub looplvl1()
for each tnode in tree.nodes
messagebox.show(tnode.text)
loopother(tnode)
next
end sub

private sub loopother(PNode As Node )
Dim TNode As Node
for each tnode in Pnode.nodes
messagebox.show(tnode.text)

next

end sub



 Reply:
by:Anonymous

 Thanks for all of the responds. It helps a lot.

Well, the loop was for a start. I need to save treeview's data into xml file. I'm still working on it.
Yanto


 Reply:
by:Robin Tucker

 When you say "loop all tree view nodes", I assume you mean you want to
iterate through the entire tree. You need recursion for this.

Public Sub Iterate ()

Iterate_Aux ( theTree.Nodes ( 0 ) )

End Sub

' --- This is a prefix iteration

Public Sub Iterate_Aux ( byref theNode as TreeViewNode )

DoSomethingWithTheNode (theNode)

' Now do something with the children of this node

for each theChildNode as TreeViewNode in theNode.Nodes
Iterate_Aux ( theChildNode )
next

End Sub

' --- This is a postfix iteration

Public Sub Iterate_Aux ( byref theNode as TreeViewNode )

' Do something with the children first

for each theChildNode as TreeViewNode in theNode.Nodes
Iterate_Aux ( theChildNode )
next

' Do something with the node.

DoSomethingWithTheNode (theNode)

End Sub


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

 

\\RecurseNodes(Me.TreeView1.Nodes)
..
..
..

Private Function RecurseNodes(ByVal Node As TreeNodeCollection)
For Each tn As TreeNode In Node
If tn.Text = "Foo" Then
Me.TreeView1.SelectedNode = tn
Return
End If
RecurseNodes(tn.Nodes)
Next tn
End Function
///

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



Posted by Xander Zelders
4 Comments



Weird integer behaviour

Found the following interesting discussion in the Newsgroups:

Weird integer behaviour
by:Jethro

Having upgraded my VB6 project ....

This doesn't work

dim i as integer

For i = 0 to 8
MyRecordset.Fields(i).Value = "Test" <---------- Error thrown here
next i
This does :

dim i as integer

For i = 0 to 8
MyRecordset.Fields(CInt(i)).Value = "Test"
next i

Weird huh ? I could understand it if i was an object, but not a primitve
(althought I notice that even primitives have inbuilt methods now)




 Reply:
by:Armin Zingler

 

Are you *sure* this is the real code? It's obvious that you didn't copy it
from VB. Can you post the real code, including the declarations? I don't
believe that the difference comes from CInt.
--
Armin


 Reply:
by:Anonymous

 if you cursor over the variable i in MyRecordset.Fields(i).Value = "Test"
what does VS show the type to be?

guy



Posted by Xander Zelders
0 Comments



reading and using an XML-string

Found the following interesting discussion in the Newsgroups:

easily reading and using an XML-string
by:DraguVaso

Hi,

I have an application that gets on a suden momenth a XML-string as parameter
(so NOT an XML-file or something like that!!). See it a little bit like a
user would type an XML-string in a Textbox.

This XML-string will be look like this: "<?xml
version="1.0"?><par><do>12345678901234</do><ca>1234567890123456</ca><c1>Mr.
Billing Billy</c1><c2>Miss. Janette
Jackson</c2><sc>TREC</sc><ch>Augmentation</ch></par>"

More structured it will be like this:

<?xml version="1.0"?>
<par>
<do>12345678901234</do>
<ca>1234567890123456</ca>
<c1>Mr. Billing Billy</c1>
<c2>Miss. Janette Jackson</c2>
<sc>TREC</sc>
<ch>Augmentation</ch>
</par>

So in my application I will have a string (strXML) which contains the whole
XML-string.

I want to be able to convert it to something, so I will be able to easily
check all the paramters in it. Something as easy accessibnle as a Collection
or a DataView or I don't know what. So I can do actions like: "strDossier =
colPar("do")" or "strDossier = dtvPar("do")" etc etc.

Does anybody knows how to do this? Is there a standard function for this? Or
should I need to write my own methods that read the string and put it into a
structure?

Thanks a lot in advance!

Pieter



 Reply:
by:Anonymous

 Check out the XMLDocument class and the LoadXML method for loading the string:

Option Explicit
Option Strict

Imports System
Imports System.IO
Imports System.Xml

Public Class Sample

Public Shared Sub Main()
'Create the XmlDocument.
Dim doc As New XmlDocument()
doc.LoadXml(("<book genre='novel' ISBN='1-861001-57-5'>" & _
"<title>Pride And Prejudice</title>" & _
"</book>"))

'Save the document to a file.
doc.Save("data.xml")
End Sub 'Main
End Class 'Sample

You can then use the class's method for searching for specific nodes and the info they contain.


 Reply:
by:DraguVaso

 Thanks!! That works great!!

Pieter



Posted by Xander Zelders
0 Comments



How to check if variable is used

Found the following interesting discussion in the Newsgroups:

How to check if variable is used?
by:dieter.lauwers@advalvas.be (dieter)

Hi,

How can I check, automatically, if a variable declared in a function is used
in that function? I have looked at FXCop, but didn't find a solution.
Greetings,

Dieter


 Reply:
by:spamfurnace

 No idea except to say that the C# background compilier seems to do this
automatically.
I'm surprised FxCop doesn't pick up this.

Richard


 Reply:
by:Lars Netzel

 I guess you can create a class with a member that would be this variable
instead and then Read it as a Property. and in that Property Get Sub you can
also set another property (IsVariable1Used) as True or something

Or is that to much of an overkill?

/lars



Posted by Xander Zelders
0 Comments



How to check if variable is used

Found the following interesting discussion in the Newsgroups:

How to check if variable is used?
by:dieter.lauwers@advalvas.be (dieter)

Hi,

How can I check, automatically, if a variable declared in a function is used
in that function? I have looked at FXCop, but didn't find a solution.
Greetings,

Dieter


 Reply:
by:spamfurnace

 No idea except to say that the C# background compilier seems to do this
automatically.
I'm surprised FxCop doesn't pick up this.

Richard


 Reply:
by:Lars Netzel

 I guess you can create a class with a member that would be this variable
instead and then Read it as a Property. and in that Property Get Sub you can
also set another property (IsVariable1Used) as True or something

Or is that to much of an overkill?

/lars



Posted by Xander Zelders
0 Comments



Dynamic Enum

Found the following interesting discussion in the Newsgroups:

Dynamic Enum
by:Anonymous

Hi All,

Is there any way to create the Enum dynamically from database table.?

Thanks
Chowdary D


 Reply:
by:spamfurnace

 Tells us what your up to Chowdary.... you can pretty much create anythig
dynamically through reflection, although whether its the best approach is
always another question.

System.Reflection.Emit
hth
Richard


 Reply:
by:Todd Zetlan

 I am actually trying to do something very similar. In my case I have an
enum that looks like:

Protected Enum serviceEnum

UNDEFINED

LOGIN

TIME

INDEX

End Enum

I need to make it more dynamic and read the values from an XML file. The
XML file structure will look something like:

<?xml version="1.0" encoding="utf-8" ?>

<company id="ABC">

<serviceIDS>

<serviceID>UNDEFINED</serviceID>

<serviceID>LOGIN</serviceID>

<serviceID>TIME</serviceID>

<serviceID>INDEX</serviceID>

</serviceIDS>

</company>


--
TODD ZETLAN



Posted by Xander Zelders
1 Comments



Chop of Decimals

Found the following interesting discussion in the Newsgroups:

Chop of Decimals
by:Stefan Richter

Hi, I am calculating percentages and I would like to round
the decimals to only 2 decimals.
Any idea how that could be done in the best way?

Thanks in advance,

Stefan


 Reply:
by:spamfurnace

 yourNum = Math.Round(yourNum, 2)

hth
Richard



Posted by Xander Zelders
1 Comments



Showing help text for functions in intellisense dropdown...

Found the following interesting discussion in the Newsgroups:

Showing help text for functions in intellisense dropdown...
by:PrakashR

Hello,
Is there any way to give some description strings to the functions of my
class so that whenever the functions are shown in the intellisense dropdown
in the IDE, those descriptions are shown with the normal signature of the
function ?
I tried adding the <DataSysDescription("My Description")> attribute to
my functions, but this doesn't seem to work. Anyone ?

PrakashR.


 Reply:
by:Ken Tucker [MVP]

 Hi,

Here is Herfried K. Wagner [MVP] links for adding xml comments.

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>

--

Ken



Posted by Xander Zelders
0 Comments



Binding Text Boxes to a Dataset

Found the following interesting discussion in the Newsgroups:

Binding Text Boxes to a Dataset
by:Anonymous

Hi there,
I am new to VB.Net (formerly a Centura 'Gupta' programmer) and just trying to do a simple excercise out of the help to populate a couple of text fields on a form by using a parameterized query..
ie. Walkthrough 'Displaying Data in a Windows Form Using a Parameterized Query'
Sounds simple but for some reason when I get to the step where you are supposed to 'Expand the (DataBindings) node, and for the Text property, expand DsAuthors1, expand authors, and select au_id from the drop-down list.'
I don't have a drop down list?! It's empty.
Please help me find what I'm missing here!

I have the following on my form:
OdbcDataAdapter with a simple select command 'SELECT MBR_SAID, MBR_SURNAME, MBR_ADDR1 FROM FHP_MBR WHERE (MBR_SAID = ?)'
OdbcConnection (to an Access database)
and a DataSet (dsMbr)

The following code is for the button click:
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
OdbcDataAdapter1.SelectCommand.Parameters("mbr_said").Value = dfnMbr_said.Text
dsMbr.Clear()
OdbcDataAdapter1.Fill(dsMbr)
End Sub

So what am I missing here please? I know it's probably simple... I just need a jumpstart!
How do I bind the results of this query to the appropriate fields?
I am using the VB.Net Standard edition and have therefore had to export my Oracle tables into Access for the purpose of this excercise since I believe you need the full blown Enterprise edition of Visual Studio to connect to Oracle.
Thanks,
Marnie.



 Reply:
by:Ken Tucker [MVP]

 Hi,

To bind a textbox to a datasource. This will bind the CategoryName
field of a dataset ds to textbox2.

TextBox2.DataBindings.Add("Text", ds.Tables(0), "CategoryName")

To use the oracle data provider you need to add a reference to
system.data.oracleclient.dll.

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

Ken


 Reply:
by:Anonymous

 Hi Ken,
Thanks for your response.

I did try using something similar to that ie:

Protected Sub BindControls()
dfsMbr_Surname.DataBindings.Add(New Binding("Text", dsMbr, "mbr.mbr_surname"))
End Sub

Should that work too?

Although I wasn't sure then where to call BindControls() from? Where are you suggesting to put the code:
TextBox2.DataBindings.Add("Text", ds.Tables(0), "CategoryName")

Does Tables(0) select the first table (being the only one in my case) in the query?

I thought that I was going to be able to do this by going through the properties of TextBox2 (in my case dfsMbr_Surname) as per the documentation. I assume the code you gave me is generated for you if you do it through the properties dialog?
Still wondering why nothing appeared in the Data Bindings section of the datafield properties?
Thanks,
Marnie.


 Reply:
by:Ken Tucker [MVP]

 Hi,

It should. I dont think you need the mbr. Try this.

dfsMbr_Surname.DataBindings.Add(New Binding("Text", dsMbr, "mbr_surname"))

Ken



Posted by Xander Zelders
0 Comments



schedule VB.NET app in Scheduled Tasks

Found the following interesting discussion in the Newsgroups:

HELP - schedule VB .NET app in Scheduled Tasks
by:tecknickal@hotmail.com (Nick)

Hi

I have created a VB .NET application which emails all staff in the
office. I would like it to run every morning at 8am. I thought that the
best way to schedule this would be through Windows Task Scheduler as I
have to start it up manually at the moment.

The program starts up fine at 8am, but it will not send out any emails.
It writes an entry to the log which has been created in the SQL Server
2000 database to say that it has commenced, but it does not send any
of the emails to any of the recipients.

At first I thought it may be encountering an error. So I have
encapsulated all code in a try-catch statement and write any of the
errors that are caught to the database, but no errors are written,
hence I presume no errors are written.

Also, when the application is started I cannot visually see it running.

Can someone please help ????

I am running the app under terminal services and I have all the correct
privelidges set. The program runs fine when I double-click the icon off
the desktop, but it won't send email through the task scheduler.

Thank you in advance.

Nick


 Reply:
by:Anonymous

 Hi Nick,

Task Scheduler is a service so any programs it starts will run under the context of the service which is why you see no user interface. The reason that your program never sends any emails is probably to do with permissions as by default, this service is set up to run under the machine's LocalSystem account which will not have have any privileges outside of the local machine.

An option would be to reconfigure the Task Scheduler service to run under the context of a network account that has the required network privileges.

HTH,
Gary



Posted by Xander Zelders
0 Comments



Deployment leaves out a file

Found the following interesting discussion in the Newsgroups:

Deployment leaves out a file
by:Aaron

Hello all,

I have started too deploy my project; but when I test it from my desktop a
file is missing from it.

This file is a xml file that has user and password within it.

Does anyone know why this file is not getting deployed with the other files?

Aaron Minoo


 Reply:
by:Anonymous

 Hi Aaron,

You need to include the file in your project first, then in the Deployment project, include the locialised resource files also.

I hope this will help you.

Sadha Sivam S
Malleable Minds Sotware Pvt Ltd.,
India


 Reply:
by:Aaron

 Sadha,

That is what I did.

Aaron



Posted by Xander Zelders
0 Comments



Connecting to FTP Server (Tuesday, October 19, 2004)

Found the following interesting discussion in the Newsgroups:

Connecting to FTP Server
by:AMC

Hi,

I have a vb.net app that needs to connect to an FTP server at set intervals
and upload some files. The computer where this runs is connected to and
receives data from another system via com port. Will I be able to have it
via it's modem and have the com port working on something else at the same
time? Hope that makes sense


 Reply:
by:Ken Tucker [MVP]

 Hi,

Here are some links to componets that do ftp.

http://www.nevrona.com/Indy/Indy.html
http://www.nsoftware.com/products/showprod.aspx?part=IPN6-A

Ken


 Reply:
by:Alex Komissarov

 http://support.microsoft.com/default.aspx?scid=kb;EN-US;832679


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

 
FTP in VB.NET/C#:

Samples:

<URL:http://support.microsoft.com/?scid=kb;en-us;812404> (VB.NET)
<URL:http://support.microsoft.com/?scid=kb;en-us;812409> (C#)
<URL:http://www.asp.net/ControlGallery/ControlDetail.aspx?Control=1874>
<URL:http://www.freevbcode.com/ShowCode.Asp?ID=4655>
<URL:http://www.allapi.net/downloads/NetFTP.zip>
<URL:http://www.visualbuilder.com/article/viewarticle.asp?id=1234>
<URL:http://www.csharphelp.com/archives/archive9.html>
<URL:http://www.codeproject.com/csharp/FTPDriver1.asp>
<URL:http://www.indyproject.org/indy.html>

Commercial components:

<URL:http://www.abderaware.com/>
<URL:http://www.nsoftware.com/products/controls/?ctl=Ftp>
<URL:http://www.xceedsoft.com/products/FtpNet/>
<URL:http://www.rebex.net/ftp.net/>

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



Posted by Xander Zelders
0 Comments



Reading .jpg file properties

Found the following interesting discussion in the Newsgroups:

Reading .jpg file properties
by:J. Jespersen

I need to read some of all the different properties on pictures taken
with a digicam. All files are jpg.

I need to read the properties such as Image Resolution, Camera Model,
Shutter Speed and so forth. Is this possible in .net, or do I need 3rd party
components?

Any help is appreciated.

Jeppe Jespersen
remove blah in email to reply directly


 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]
<URL:http://dotnet.mvps.org/>


 Reply:
by:J. Jespersen

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

Thank you very much. Looks very useful.

Jeppe



Posted by Xander Zelders
0 Comments



Reading .jpg file properties

Found the following interesting discussion in the Newsgroups:

Reading .jpg file properties
by:J. Jespersen

I need to read some of all the different properties on pictures taken
with a digicam. All files are jpg.

I need to read the properties such as Image Resolution, Camera Model,
Shutter Speed and so forth. Is this possible in .net, or do I need 3rd party
components?

Any help is appreciated.

Jeppe Jespersen
remove blah in email to reply directly


 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]
<URL:http://dotnet.mvps.org/>


 Reply:
by:J. Jespersen

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

Thank you very much. Looks very useful.

Jeppe



Posted by Xander Zelders
0 Comments



Application Info Variables

Found the following interesting discussion in the Newsgroups:

Application Info Variables
by:Max

Couldn't call it anything better, just remember back when I was
programming in VB6 there was some way of accessing stuff like the build
version, name, path the program is being run from, and all that other
stuff... Can't remember or find how to get all of that again, could you
help me out? And this is with VB.NET if it changed from 6.0.


 Reply:
by:Armin Zingler

 
http://msdn.microsoft.com/library/en-us/vbcon/html/vboriIntroductionToVisualBasic70ForVisualBasicVeterans.asp

especially
http://msdn.microsoft.com/library/en-us/vbcon/html/vxconChangesToAppObjectInVisualBasicNET.asp
--
Armin



Posted by Xander Zelders
0 Comments



Application Info Variables

Found the following interesting discussion in the Newsgroups:

Application Info Variables
by:Max

Couldn't call it anything better, just remember back when I was
programming in VB6 there was some way of accessing stuff like the build
version, name, path the program is being run from, and all that other
stuff... Can't remember or find how to get all of that again, could you
help me out? And this is with VB.NET if it changed from 6.0.


 Reply:
by:Armin Zingler

 
http://msdn.microsoft.com/library/en-us/vbcon/html/vboriIntroductionToVisualBasic70ForVisualBasicVeterans.asp

especially
http://msdn.microsoft.com/library/en-us/vbcon/html/vxconChangesToAppObjectInVisualBasicNET.asp
--
Armin



Posted by Xander Zelders
0 Comments



Application Info Variables

Found the following interesting discussion in the Newsgroups:

Application Info Variables
by:Max

Couldn't call it anything better, just remember back when I was
programming in VB6 there was some way of accessing stuff like the build
version, name, path the program is being run from, and all that other
stuff... Can't remember or find how to get all of that again, could you
help me out? And this is with VB.NET if it changed from 6.0.


 Reply:
by:Armin Zingler

 
http://msdn.microsoft.com/library/en-us/vbcon/html/vboriIntroductionToVisualBasic70ForVisualBasicVeterans.asp

especially
http://msdn.microsoft.com/library/en-us/vbcon/html/vxconChangesToAppObjectInVisualBasicNET.asp
--
Armin



Posted by Xander Zelders
0 Comments



usercontrol 'about box'

Found the following interesting discussion in the Newsgroups:

usercontrol 'about box' help please!
by:Anonymous

i have a usercontrol i authored. from the designer, i'd like to make it possible to right-click and select "about". or, alternatively, an about property that when you click the '...' button, it shows the about form. is this possible? i've seen many other custom controls do something similar.


 Reply:
by:yEaH rIgHt

 See UITypeEditor:

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



Posted by Xander Zelders
0 Comments



Getting Lease Info From DHCP Server

Found the following interesting discussion in the Newsgroups:

Getting Lease Info From DHCP Server
by:Anonymous

Hello,
I am trying to find a way to get/export the current leases from a DHCP server. I would like to use VB .Net if possible. I know I can use DHCP MMC Snap-In to view all the leases so, I would think there would be an API or something that MMC uses to gather this info. If anyone has any ideas or knows of a link that I could read about it please let me know.

Thank You,

Robin


 Reply:
by:Richard T. Edwards

 Make a reference to System.Management. Add the following code.

Dim Mos As Management.ManagementObjectSearcher = New
Management.ManagementObjectSearcher("SELECT * FROM
WIN32_NetworkAdapterConfiguration")

Dim MOC As Management.ManagementObjectCollection = Mos.Get()

Dim MO As Management.ManagementObject

Dim propC As Management.PropertyDataCollection

Dim prop As Management.PropertyData

For Each MO In MOC

Console.Out.Write(MO.GetText(Management.TextFormat.Mof))

Next

This will send hte output to the output window.

You can also query for specific details. Anyway, comes back with what's in
hte registry:

<DHCPLeaseExpires></DHCPLeaseExpires>
<DHCPLeaseObtained></DHCPLeaseObtained>
news:1BBCAB61-FAD1-4582-882D-593A9936C94C@microsoft.com...

DHCP server. I would like to use VB .Net if possible. I know I can use DHCP
MMC Snap-In to view all the leases so, I would think there would be an API
or something that MMC uses to gather this info. If anyone has any ideas or
knows of a link that I could read about it please let me know.


 Reply:
by:Anonymous

 Richard,
Thanks for the info but, this only give the information for 1 machine. I need to get all the leases that are currently active from a DHCP server. For example if your IP address range was 200.100.50.1 thru 200.100.50.200 I would like to see which system has what IP address from the DHCP server. I hope this is a bit clearer in what I am trying to get.

Thanks again for your responce.

Robin




Posted by Xander Zelders
0 Comments



DataGrid rowIndex

Found the following interesting discussion in the Newsgroups:

DataGrid rowIndex
by:Anonymous

I got a problem when I try to catch the row number of DataGrid by using currentRowIndex, it returned some number that is not indicated the selected row while mouse_down event.
Thanks.



 Reply:
by:CJ Taylor

 Personally, I would use a currency manager.

i.e.

Dim cM as CurrencyManager
cM = BindingContext(myDataSet, "myDataTable")
rowIndex = cM.Position

-CJ


 Reply:
by:Anonymous

 Thanks Taylor, but it doesn't work for me, and I just want to get the selected row index of the DataGrid. Do you know can I get this in any event?



Posted by Xander Zelders
0 Comments



Open New Panel in User Interface

Found the following interesting discussion in the Newsgroups:

Open New Panel in User Interface
by:simchajoy2000@yahoo.com

Hi,

I am working on a user interface where I have made it possible for
users to open a new panel in the main form. However, since this
occurs after the main form has already loaded, the new panel opens up
next to the toolbar and status bar instead of between them. Does
anyone know how I can fix this problem?

Joy


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

 

Use the code you use to "open" the panel.

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


 Reply:
by:Joy Labadie

 
I don't understand how that would be helpful since the problem occurs
when the Open function is called by the user after the main form has
been loaded.

Joy


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

 Joy,


Oh, sorry, I made an ugly "typo". I wanted to say that it would be
great if you could /post/ the code you use to show the panels.

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


 Reply:
by:Joy Labadie

 
Wow, well that gets more complicated because I am using many different
classes (object-oriented approach) to do the job and you probably
wouldn't be able to make sense of my code if I did post it. Is there
any advice you could offer me without actually seeing the code?

Basically it looks fine when it initially loads the main form - but the
form in question is a dockable/floatable form, so when the user pulls
the form away from the dock and then puts it back - the form is no
longer between the status bar and toolbar - it's right next to them if
that makes sense.

Joy



Posted by Xander Zelders
0 Comments



Windows Installer

Found the following interesting discussion in the Newsgroups:

Windows Installer
by:Anonymous

This may qualify as a stupid question -- or as Chris Berman said, "There are no stupid questions. Only stupid people who ask questions."

I finally have my windows installer where I want it. It loads the dotnet framework semi-silently, installs the main installer along with an automatic upgrade feature.

Then, I hit one more snag. Some of the install computers do not have the latest version of windows installer. My question: Is there a neat easy way to automatically check and install the installer if necessary... and then go on with the rest of the install?

Eric Fleet


 Reply:
by:Sven Groot

 Eric Fleet wrote:

Locate %WinDir%\System32\msiexec.exe and check the file version. If it's not
the (newer than) the version you want, install InstMsiW.exe on WinNT/2000,
and InstMsiA.exe on Win9x/Me. Both files can be found on the Microsoft
website, in the download center.

--
Sven Groot

http://unforgiven.bloghorn.com




Posted by Xander Zelders
0 Comments



DataGrid column Locked Property

Found the following interesting discussion in the Newsgroups:

DataGrid column Locked Property
by:David L Wright II

In VB6, any column in the DataGrid had a Locked Property. I can not find
this property in the .Net DataGrid. Where is this property or what is the
replacement property?


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

 Hi David,

First of all, I would like to confirm my understanding of your issue.
From your description, I understand that you wants to make one of the
column in the datagrid readonly in VB.NET
Have I fully understood you? If there is anything I misunderstood, please
feel free to let me know.

I think we can use the DataGridTableStyle and DataGridColumnStyle to do
the job.

Here is simple code snippet.

Dim ts As DataGridTableStyle
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'fill data into dataset11
Me.OleDbDataAdapter1.Fill(Me.DataSet11)
'add a new DataGridTableStyle
ts = New DataGridTableStyle
ts.MappingName = Me.DataSet11.Employees.TableName
Me.DataGrid1.TableStyles.Add(ts)
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
'get the Address column and set its readonly property to true so that we
are not able to modify the Address column.
Dim cs As DataGridColumnStyle = ts.GridColumnStyles("Address")
cs.ReadOnly = True
End Sub

Please apply my suggestion above and let me know if it helps resolve your
problem.
Best regards,

Peter Huang
Microsoft Online Partner Support


 Reply:
by:David L Wright II

 Peter,

I can make your example work with some additional coding.

Thanks,
Dave



Posted by Xander Zelders
0 Comments



how to use RS232 in vb.net

Found the following interesting discussion in the Newsgroups:

how to use RS232 in vb.net
by:Jan

Hello people,

Can somebody tell where I can find a good site for info about rs232
communication with VB.net.

TIA


 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]
<URL:http://dotnet.mvps.org/>


 Reply:
by:md

 google.com, search there and you will find tons of information


 Reply:
by:Charles Law

 Hi Jan

If you want some code, have a look here

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

HTH

Charles


 Reply:
by:Thomas Lutz

 Try:

www.hardandsoftware.com

Look in the downloads section of the site for a tool called NetCOMMOcx
For other serial I/O tools, utilities and tutorials visit:
www.taltech.com



Posted by Xander Zelders
0 Comments



application configuration file

Found the following interesting discussion in the Newsgroups:

application configuration file
by:Eric Dreksler

Hello all,
I was wondering if it's possible to write to an application config file at
runtime.
I wrote a bit of code to read the file and when I tried to write to it I got
an error, I've been looking through MSDN for any info, but all I get is how
to read the file and no specific statement saying it can't be written to.

Basically, I have the default path for some directories and dbs that the app
needs, and want to be able for the user to just select the new location and
save it back into the .config file, if anything changes on the filesystem.

Thanks In Advance,
Eric Dreksler


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

 

The config file should not be used to store user preferences.

Configuration Management Application Block
<URL:http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/cmab.asp>

<URL:http://www.palmbytes.de/content/dotnetlibs/optionslib.htm>

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


 Reply:
by:Eric Dreksler

 Thanks for the links and the info.

Eric Dreksler



Posted by Xander Zelders
0 Comments



Windows Explorer add-in

Found the following interesting discussion in the Newsgroups:

Windows Explorer add-in
by:Martijn

Hello,

How do I create a windows explorer add-in? We use a Document Management
System to save our documents. this DMS is integrated with office but I want
to create add-in into the windows exlporer so that I can save any file from
any application into this DMS.

Hopefully somebody has some code

Thanx


 Reply:
by:Juan Romero

 Check this guy's page out:

http://www.mvps.org/emorcillo/

This guy is the MASTER of addins man. I got my stuff from there.



Posted by Xander Zelders
0 Comments



listbox displaying more than one item

Found the following interesting discussion in the Newsgroups:

listbox displaying more than one item
by:Anonymous

Hello,
How do I make a listbox display 2 fields from a SQL table?
Thanks,
amber



 Reply:
by:Tom Shelton

 
Use a listview?

--
Tom Shelton [MVP]


 Reply:
by:Anonymous

 So it isn't possible with a listbox?
Okay, I've been looking at listview, but I'm a little confused as to how to populate a listview from a dataview...
With the Listbox, I used the code:

lstAmend.DataSource = dvRPA
lstAmend.DisplayMember = "NUM_AMENDMENT"

but this isn't available for listviews.
I need to be able to display a list of items (containing two columns) from a dataview.

Thanks,
amber




Posted by Xander Zelders
3 Comments



Record Not Added - 0 - Microsoft Jet Database Engine - Syntax Error in INSERT INTO statement -- 0

Found the following interesting discussion in the Newsgroups:

DataSet Update Error
by:gaurav@gambhir-dot-net.no-spam.invalid (GG)

I have a very simple form that I am using to take in the information
and save it to the MS Access Database using dataset.

My DataAdapter is called dadConstituent
and dataset is called dstConstituent

I am getting a "Record Not Added - 0 - Microsoft Jet Database Engine -
Syntax Error in INSERT INTO statement -- 0"..

Please look at the Msgbox to see the format of the error that I am
printing out.

I am sure the problem is very small but I just can't seem to put my
finger on it.

THanks a ton,
GG

Private Sub btnSave_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles btnSave.Click
Dim rowNewRow As DataRow =
dstConstituent.ConstituentData.NewRow

Try
'rowNewRow("FileNumber") =
txtAutoNumber.Text
'rowNewRow("PersonIntake") =
cmbIntakePerson.Text
'rowNewRow("Category") =
cmbCategory.Text
'rowNewRow("LastName") =
txtLastName.Text
'rowNewRow("FirstName") =
txtFirstName.Text
'rowNewRow("MiddleInitial") =
txtMiddleName.Text
'rowNewRow("Title") = txtTitle.Text
'rowNewRow("Organization") =
txtOrganization.Text
'rowNewRow("PrimaryPhone") =
txtPriPhone.Text
'rowNewRow("PrimaryExt") =
txtPriExt.Text
'rowNewRow("PrimaryMobile") =
txtPriMobile.Text
'rowNewRow("PrimaryPager") =
txtPriPager.Text
'rowNewRow("PrimaryFax") =
txtPriFax.Text
'rowNewRow("PrimaryAddress") =
txtPriAddress.Text
'rowNewRow("PrimaryCity") =
txtPriCity.Text
'rowNewRow("PrimaryState") =
txtPriState.Text
'rowNewRow("PrimaryZip") =
txtPriZip.Text
'rowNewRow("OtherPhone") =
txtOtherPhone.Text
'rowNewRow("OtherExt") =
txtOtherExt.Text
'rowNewRow("OtherAddress") =
txtOtherAddress.Text
'rowNewRow("OtherCity") =
txtOtherCity.Text
'rowNewRow("OtherState") =
txtOtherState.Text
'rowNewRow("OtherZip") =
txtOtherZip.Text
'rowNewRow("Request") = txtRequest.Text
'rowNewRow("Action") = txtAction.Text


dstConstituent.Tables(0).Rows.Add(rowNewRow)

btnNext.Enabled = True
btnPrevious.Enabled = True
btnFirst.Enabled = True
btnLast.Enabled = True
btnAdd.Enabled = True
btnSave.Enabled = False
btnCancel.Enabled = False
dadConstituent.Update(dstConstituent)

dstConstituent.Clear()
dadConstituent.Fill(dstConstituent,
' lblPosition.Text = "Record 1 of " &
(dstConstituent.Tables(0).Rows.Count)

Catch
MessageBox.Show("Record not added" &
& " - " & Err.Description & " -- "
& Err.HelpContext)
End Try

End Sub



 Reply:
by:William Ryan eMVP

 GG:

You are trapping the whole block... a lot of things can go wrong with Update
so I'd recommend trapping an oledbException around it individually. Are
you sure it's the update that's triggering it? It could be a bunch of
things though, a bad connection string, a bad update statement etc.

Anyway, if you would , trap OleDbException and do a Debug.Assert(False,
ex.ToString) 'assuming ex is the variable name of the exception. That will
help narrow it down.



Posted by Xander Zelders
0 Comments



Updating a SQL database

Found the following interesting discussion in the Newsgroups:

Updating a SQL database
by:Anonymous

I tried posting this yesterday, but it didn't come up as a new post:

Subject: Re: Updating a SQL database 5/5/2004 10:55 PM PST

Hi Bill,
Thanks for your help :)
I added the "debug.assert()" line, and it did come up with an error...so I guess there is nothing to update.
I did run the wizard, and it did generate all the sql commands.
I've been battling this for a while, and was told I had to add the 'commandbuilder' line...
Does it have anything to do with the fact that I'm using a dataview, of a dataset, then trying to update the dataset?
What I have is a form that has text fields populated (by this dataview) from a SQL database. I'm changing the text in them to trigger a 'change' so the update command will work.
A 'save' button calls the update method.
Any ideas??
Thanks
amber

in response to:

Hi Amber:
news:A5A00E4D-1378-4B25-B8DC-B0272FF9E322@microsoft.com...
and it created the 'UPDATE' code as follows:
System.Data.SqlClient.SqlParameter("@STR_COMMENT",
System.Data.SqlDbType.NVarChar, 1073741823, "STR_COMMENT"))
EventArgs) Handles btnSave.Click

What exactly do you mean when you say it 'doesn't work'? There can be a few
things. The first thing to do is verify that you have changes in your
dataset, if you don't, calling update 10000000 times won't do a thing. So,
right before the Update command, insert this:

Debug.Assert(DsCBLP1.HasChanges)

Now, if you get a big ugly messagebox popping up, the problem is that you
don't have any changes in the DB. You may need to call EndCurrentEdit or
one of a few other things... So verify the HasChanges first and we'll
eliminate things from there.

Next, are you gettting an exception or is it just not updating the changes
in the DB?

Another thing, if you use the COnfiguration wizard, it should gen the logic
for you for the Update/Delete/Insert statements. you don't need a
commandbuilder and you don't want to use it if you already have your logic
in place. When you ran the configuration wizard, did it tell you that it
succesfully created the Update/Insert/Delete commands? If you don't have a
key for instance, it won't work but neither will the CommandBuilder -
although it should throw an exception.

Let me know about these and we'll take it from there.

Cheers,

Bill



 Reply:
by:Anonymous

 Hey Amber,
It shouldn't be a tough task. Here is some code that I wrote in my own program. In this program I fill out a grid with values(in your case it will be a text box with values). I then make changes to my grid automatically, in your case you make changes to your test box and hit the update button. My suggestion would be to make a datagrid that gets populated by the sql database, and hide this datagrid. Make a change to the testbox which will change the datagrid at the required position(this is done by the last part of my program). Hit the update button and it will update the dataset(this is shown by the update part of my program at the end).

Let me know of any issues or questions.

cheers,

Ranjan

Dim ds As New DataSet
Dim dr As DataRow
Dim cnn As New SqlConnection("Data source=testbox; initial catalog = PUBS; USER ID=; password = ;")


Dim count As Integer = 0

Dim cmdselect As New SqlClient.SqlCommand
Dim cmdupdate As New SqlClient.SqlCommand
Dim cmdinsert As New SqlClient.SqlCommand



cmdselect = cnn.CreateCommand
cmdselect.CommandText = "SELECT field1,field2,field3 from Table"

da.SelectCommand = cmdselect
cmdupdate = cnn.CreateCommand
cmdupdate.CommandText = "UPDATE Table " & _
"SET field1 = @field1 " & _
"WHERE field2 = @field2"
prm = cmdupdate.Parameters.Add("@field1", SqlDbType.NChar, 1, "field1")


prm.SourceVersion = DataRowVersion.Original
da.UpdateCommand = cmdupdate



da.Fill(ds, "Table")

DataGrid1.DataSource = ds
DataGrid1.DataMember = "TABLE"

Dim firstname1 = "someonesname@mysite.com"
Dim adredit() = ds.Tables("table").Select("field2 = '" & firstname1 & "'")

For Each dr In adredit

dr(2) = "change the value here to edit"

Next

da.Update(ds, "Table") 'update it.


 Reply:
by:Anonymous

 Thanks Ranjan, but I was hoping to have my specific questions answered, instead of starting all over again...
Are you out there Bill?

As I said, I'm wondering if my problem lies with the fact that I'm using a dataview, of a dataset, then trying to update the dataset?
We've narrowed it down to the fact that my dataset isn't changed, so when I call the update command, there are no updates to perform.
My code was pasted in the first post.

Thanks,
Amber



Posted by Xander Zelders
0 Comments



Set Rich Text Box Control Margin

Found the following interesting discussion in the Newsgroups:

Set Rich Text Box Control Margin
by:Juan Romero

Guys,

Does anyone know how to set a RichTextControl Left Margin?

I tried using the API but it is not working. I must be doing something
wrong. Here is my code:

Private Const EC_LEFTMARGIN = &H1
Private Const EC_RIGHTMARGIN = &H2
Private Const EC_USEFONTINFO = &HFFFF&
Private Const EM_SETMARGINS = &HD3&
Private Const EM_GETMARGINS = &HD4&

Private Declare Function SendMessageLong Lib "user32" Alias "SendMessageA"
(ByVal hwnd As IntPtr, ByVal wMsg As Long, ByVal wParam As Long, ByVal
lParam As Long) As Long

Private Sub SetLeftMargin(ByVal lhWnd As IntPtr, ByVal lMargin As Long)
Dim lLongValue As Long
Dim Result As Long
Result = SendMessageLong(lhWnd, EM_SETMARGINS, EC_LEFTMARGIN,
lMargin)
End Sub

The call to the function is:
SetLeftMargin(Me.Handle, 100) 'Me = Richtextbox control

Any ideas?

Thanks!


 Reply:
by:yEaH rIgHt

 Change the all the Longs to Integers. Then it will work


 Reply:
by:Juan Romero

 Thanks Man!

I wonder why that happens....


 Reply:
by:hirf-spam-me-here@gmx.at (He