ENCODING loss on Read and Write file
hallo
encoding loss here, i presume
situation:
Visual Web Developer 2005 creates a new html file
with Visual Web Developer 2005 I write some odd chars
the browser displays them good
now:
with vb code net (fx 2.0) I open the html file
I add the "hallo" string in the Body section
(near the odd chars)
I save the file
the browser doesn't display the odd chars
(now I see only the ? char in their positions,
that is the question mark)
QUESTION:
how to open and write a file
keeping the original encoding
(I think when managing html file
the encoding offered by Visual Web Developer
is the best and it is to be kept ) ?
Or at least, never loose an odd char after Reading and Writing?
Code, ideas, workarounds, external dll...
everything is appreciated Tag: Why does CLick once insist on .net 3.5 Tag: 411297
WinForm app speed issue
Hi
I have a multi-form winform database application. The client keeps
complaining that application runs too slow 50% of the time. The problem
seems to be in two areas;
a) app is slow maximising after a prolonged period of being minimised.
b) when user clicks on a toolbar to select one of the several already open
forms.
This seems to suggest that there is nothing wrong with application per se as
application works fine 50% and also maximising app or moving from one open
form to another open form does not do anything special code wise. Also as
other non .net apps run just fine on the same pcs, this can't be due to spec
of pcs. I have also ngen'd the app using command line 'ngen install
myapp.exe'.
I am therefore wondering what can be causing this slow response and would
appreciate any help in ironing out this speed issue.
Many Thanks
Regards Tag: Why does CLick once insist on .net 3.5 Tag: 411296
Constant Expression Is Required Vb.Net 2008
I am trying to create an attribute of type Icon and have the following code:
<AttributeUsage(AttributeTargets.Class)> _
Public Class PIMSGridViewIconAttribute
Inherits System.Attribute
'/// Private variables
Private oPiGridViewIcon As System.Drawing.Icon = Nothing
'/// Construtor
Public Sub New(ByVal Value As System.Drawing.Icon)
oPiGridViewIcon = Value
End Sub
'/// Public properties
Public ReadOnly Property GridViewIcon() As System.Drawing.Icon
Get
Return oPiGridViewIcon
End Get
End Property
End Class
And then on a class I attempt to set it to an icon within a resource file
with:
<PIMSGridViewIcon(My.Resources.resIcons.Team)> _
However, this gives an error of "Constant expression is required.". Please
can someone advise what I am doing wrong and how I can set the attributes
value per class?
Kind regards
Rob Tag: Why does CLick once insist on .net 3.5 Tag: 411288
How to display a resize handle in the bottom right corner of a form
Hi All,
I'd like to display a "resize handle" in the bottom right corner of a
form like in the windows explorer for instance (the 3 diagonal lines
in the corner).
Can anybody tell me how to do that?
Thanks
JB Tag: Why does CLick once insist on .net 3.5 Tag: 411287
EnumAvailableSqlServers and passing the name of the servers
Hi!
I have the following snippet that gives the name of the sql servers
installed:
Private Sub MainForm_Load(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles MyBase.Load
'just list local servers, set to false if you want to see all
servers
Dim dataTable = SmoApplication.EnumAvailableSqlServers(False)
lstServers.ValueMember = "Name"
lstServers.DataSource = dataTable
End Sub
We have only 2 sql server where the client data reside, but then we
have instances of sql installed in other machines.
I only want to be able to show in my listbox for the user to choose,
those with the sql part in their name.
e.g. tg-ny-sql001
tg-ny-sql002
so the condition would be if the name has sql in it show it in the
listbox.
How can I achieve this with VB 2008 and using SQL Server 2000 in the
first server and SQL Server 2005 in the second server?
Thanks in advanced!
Tammy Tag: Why does CLick once insist on .net 3.5 Tag: 411286
ENCODING loss on Read and Write file
hallo
encoding loss here, i presume
situation:
Visual Web Developer 2005 creates a new html file
with Visual Web Developer 2005 I write some odd chars
the browser displays them good
now:
with vb code net (fx 2.0) I open the html file
I add the "hallo" string in the Body section
(near the odd chars)
I save the file
the browser doesn't display the odd chars
(now I see only the ? char in their positions,
that is the question mark)
QUESTION:
how to open and write a file
keeping the original encoding
(I think when managing html file
the encoding offered by Visual Web Developer
is the best and it is to be kept ) ?
Or at least, never loose an odd char after Reading and Writing?
Code, ideas, workarounds, external dll...
everything is appreciated Tag: Why does CLick once insist on .net 3.5 Tag: 411281
clearing a combo box...
I have something strange going on - pretty sure it used to work before - and
now it does not...
Why does the following code not clear a combo box?
Me.cboLocation.Text = String.Empty
OR
Me.cboLocation.Text = ""
Neither of the above works. The combo box contents remain exactly the same
after running that command...
Help!
Thanks, Brad Tag: Why does CLick once insist on .net 3.5 Tag: 411277
Split function question
Hi
I have written a Split function which in turn calls the standard string
split function. Code is below;
Function Split1(ByVal Expression As String, Optional ByVal Delimiter As
String = " ", Optional ByVal Limit As Integer = -1, Optional ByVal Compare
As CompareMethod = CompareMethod.Binary, Optional ByVal MaxLength As Integer
= 0) As String()
InAr = Expression.Split(Delimiter, Limit, Compare)
End Function
My questions are ;
1. Passing the Limit parameter causes a runtime error as the default for
Limit (-1) is not acceptable. What is the problem? I have a feeling the
syntax of split function in MSDN
(http://msdn.microsoft.com/en-gb/library/6x627e5f.aspx) may be out dated.
2. How can I overloaded my split function with standard split function so I
can use is as St.Split(...)?
Thanks
Regards Tag: Why does CLick once insist on .net 3.5 Tag: 411273
Check for ReadOnly File is in Use
All,
I am working on one product where we need to check for physical file
is in use (if it is open by other application). What I found out is that I
am able to trap for those files whose attribute is not Set as ReadOnly. I
have done this by opening file using FileStream Object opening in Edit mode
with No Shared. But if I am try to apply same logic for ReadOnly files, then
it throws NonAuthorized exception. This exception is also raised even when I
try to open this file even if this is not in use by other application.
Any suggestion would be helpful
Thanks
Mayur Chauhan Tag: Why does CLick once insist on .net 3.5 Tag: 411272
AppDomain
I have an application (Winforms application) that allocates quite a bit of
memory (like 45mb). This application is destined to run in a Terminal Server
environment by multiple users at the same time.
I would like to reduce the footprint as much as possible.
I have read a little about AppDomain, but I am have no idea how to implement
it for my application.
Any AppDomain for Dummies help would be greatly appreciated.
VS2005 VB.NET Tag: Why does CLick once insist on .net 3.5 Tag: 411270
Coding a USB connection
Hi all. I have a slight issue I would like to get around if anyoine can
help.
I have a WM5 device running a keyboard wedge bit of software, this I've
written and it works well. However I have problems with the USB device
dropping off every now and then, then you have to go through the connection
process again, this is quite annoying!
Has anyone got any idea if it is possible to programatically create a
connection to a USB device through a Com port, or do you have to use the USB
connection wizard thing?
If I could force the connection in code I could simply check for the
connection state? Possibly? And if the expected connection isn't there,
add it it?
Any ideas would be greatfully received.
Cheers. Tag: Why does CLick once insist on .net 3.5 Tag: 411269
Date converison
I am working with a tps file where the date they use is something like
75736. This number is the number of days since December 28,1800. I
know how to get this number with the code below
Dim d As DateTime = New DateTime(1800, 12, 28)
MsgBox(DateTime.Today.Subtract(d).Days()) 'returns 75736 on
5/7/08.
However, how can i convert the 75736 to 5/6/2008? Thank you for your
help Tag: Why does CLick once insist on .net 3.5 Tag: 411259
VB.NET COM DLL form a VBScript
Hi to all!
I created a VB.Net COM DLL which I can use in VBScript.
I followed the steps in the following article:
http://msdn2.microsoft.com/en-us/library/x66s8zcd(VS.71).aspx
(I used the method "with COM class template")
My DLL got created fine - no errors in build process.
The "Make Assembly COM-Visible" checkbox is checked.
the ComClass1 class is below (dll / assembly name is ClassLibrary1):
--------------begin of code
<ComClass(ComClass1.ClassId, ComClass1.InterfaceId,
ComClass1.EventsId)> _
Public Class ComClass1
Public Sub Importa(ByRef o As VISUMLIB.Visum)
MsgBox(Marshal.IsComObject(o))
o.Net.Marking.Clear()
End Sub
#Region "GUID COM"
' Questi GUID forniscono l'identit=E0 COM per la classe
' e le sue interfacce COM. Se vengono modificati, i client
' esistenti non saranno pi=F9 in grado di accedere alla classe.
Public Const ClassId As String =3D "381f7f94-e48b-431d-
bdaa-2068442c90e6"
Public Const InterfaceId As String =3D "2dded33c-22ac-4816-a2f2-
ec8d228686b3"
Public Const EventsId As String =3D "2d8d4753-4d5e-4b58-
b75c-6e3fab5dad8a"
#End Region
' =C8 possibile creare classi COM solo se dispongono di una Public
Sub New()
' senza parametri. In caso contrario, infatti, la classe non pu=F2
essere
' registrata nel registro COM e non pu=F2 essere creata
' con CreateObject.
Public Sub New()
MyBase.New()
End Sub
End Class
-----------------end of code
As you can see I created a public method called Importa that accept as
input a COM object from a library referenced in .NET ("VISUMLIB")
Then I wrote a vbscript which creates an instance of the object:
Set dllobject =3D CreateObject("ClassLinrary1.ComClass1")
It works correctly!
Then I put in the vbs script then statement:
dllobject.Importa comobjectname
The output is a msgbox with "True" (result of
MsgBox(Marshal.IsComObject(o)).
So the object I'm sending to the dll method is a true COM object.
The problem is in the statement inside the sub:
"o.Net.Marking.Clear()"
I'm trying to execute the method Clear() of the container
"o.Net.Marking".
In my development machine everything works corretly.
But I tried to install the dll (I created a setup) and when It comes
to execute the statement
"o.Net.Marking.Clear()"
The vbscript breaks with the following error:
----------
"Unable to cast COM object of type "VISUMLIB.VisumClass" to interface
type
'VISUMLIB.IVisum'. This operation failed
because the QueryInterface call on the COM component for the interface
with
IID '{33B2B132-69BE-4ADE-A90E-939972B93FD5}' failed due to the
following
error: No such interface supported (Exception from HRESULT:
0x80004002
(E_NOINTERFACE)).
Source:Interop.VISUMLIB
----------
Can you help me sith any suggestions?
Thank you very much
M.G. Tag: Why does CLick once insist on .net 3.5 Tag: 411257
Retrieving the DefaultValue for a property from a function ..?
Hi folks,
I'd like to retrieve default values for properties (of a user control) via
code instead of having string-constants.
Consider the following (simplified) property:
Private _MyColor as Color
<DefaultValue(GetType(Color), "1, 2, 3")> _
Public Property MyColor() As System.Drawing.Color
Get
Return _MyColor
End Get
Set(ByVal value As System.Drawing.Color)
_MyColor = value
End Set
End Property
Public Sub ResetMyColor()
'...
End Sub
Public Function ShouldSerializeMyColor() As Boolean
'...
End Function
The default-value for the above prop is set to "1, 2, 3". I'd like to not
have that value be specified in the property itself but rather in a
different class that defines the values.
Is there any way to achieve this ..?
The reason for this is actually pretty simple - there is a bunch of
user-controls in my ClassLib. All controls therein share a common set of
colors that is to be used per default. To have all colors in a central
place (in case values need to be changed) I created a class that exposes a
GetColor-function and takes an enum. If anyone can come up with a better
approach, I'd be happy as well! :-)
Cheers,
Olaf Tag: Why does CLick once insist on .net 3.5 Tag: 411256
XML Config File handling with .NET Setup Project
Let's say I have a .NET application that uses an XML file to define
various configuration settings. So that I don't have to create the
file the first time the code runs, I create a "stub" of the file and
include it in a standard Setup package. But what if I have been using
the application for a while, and I add some features to the
application so that I need to re-install it. How do I set the Setup
package to recognize that the file is already there and not overwrite
it with an empty stub? Tag: Why does CLick once insist on .net 3.5 Tag: 411254
Splitting string over word boundry
Hi
I need to split a string in chunks of max 160 characters but ensuring that
no word is broken. How can I do this?
Thanks
Regards Tag: Why does CLick once insist on .net 3.5 Tag: 411249
delegate problem in translate from c#
I have problem with translate next code from c# to vb :
private UStateEventHandler _myUStateEventHandler;
//where UStateEventHandler is defined as :
//public sealed delegate UStateEventHandler : System.MulticastDelegate
// Create the event handlers we need.
_myUStateEventHandler = _obj1.CreateEventHandler(new
UStateEventHandler(OnUserStateChange));
// Add the event handlers to the session-global events.
obj1.UStateChanged += _myUStateEventHandler;
//where UStateChanged defined in class library as:
//public abstract new event UStateEventHandler UStateChanged
How I can translate to vb +- ?
Thanks Tag: Why does CLick once insist on .net 3.5 Tag: 411243
SerialPort class and timeout
Hi all,
i'm in a trouble handling timeouts of the SerialPort class.
If I set timeouts (<>0) what i have to expect? An error? A call to
DataReceived routine? A call to Error routine?
What is the initial moment when the timeout count starts? When i open the
port? When I send data? Delay between chars?
What is the 'real' minimum timeout the code is able to handle? What about 5
ms??
Thanks!
--
SteM Tag: Why does CLick once insist on .net 3.5 Tag: 411235
Why does CLick once insist on .net 3.5
Hi,
I have a basic app that I have build and am trying to use the click
once/publish feature to make the installation.
I have create a Virtual Machine using XP SP2, install VS.2005(aka dev) and
created the project.
I have a second Virtual Machine also with XP SP2(aka Clean), nothing else
installed.
When I use the Clean machine to run the installation it first wants to to
install dotNet framework 3.5
I don't want to have the user having to install 62mb of .net 3.5 framework
when the application is build for 2.0
I have checked the setting for the publish now function, and the only
Prerequisite is .net framework 2.0
Even when I unclick this (to test) the application installation still wants
to install .net 3.5 framework.
What is going on!!!
I want to have XP Sp2 users using my applicaton, so since they already have
2.0 then I don't have to install anything but my little application Tag: Why does CLick once insist on .net 3.5 Tag: 411233
FileSystemWatcher class and .NET 2.0 documentation
This web page on FileSystemWatcher Class in .net 2.0 says that the
class works on a win98 platform.
http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher(VS.80).aspx
I know for certain FileSystemWatcher does NOT work in .net 1.0 on a
win98 platform.
Was FileSystemWatcher fixed in .net 2.0 ?
Thanks... Tag: Why does CLick once insist on .net 3.5 Tag: 411229
Tape Device access via vb....
Has anyone every used VB.net to control/write/read a tape device such as
LTO or SDLT? I'd like to be able to write a TAR utility within vb.net
that write to the tape device. Any suggestions? Tag: Why does CLick once insist on .net 3.5 Tag: 411227
Passing various class types as parameters
Hi
I have the following code;
Public DA(3) As Object
DA(1) = New Class1
DA(2) = New Class2
Is there a way to pass the class types as parameter to a sub as below;
SetDA(Class1,1)
SetDA(Class2,2)
where the sub declares variables for the passed class types, as below?
Sub SetDA(ByRef ClassType As Object, ByVal Subs As Long)
DA(Subs) = New ClassType
End Sub
Thanks
Regards Tag: Why does CLick once insist on .net 3.5 Tag: 411219
Domain name.
Hi;
I'm a VB programmer (since v4) and I noticed that VBLanguage.com was
available last week so I grabbed it for resale. I'd like to give you guys in
the Microsoft newsgroups the first shot at it if anyone is interested.
It might make for a cool web site for somebody here.
See ya.
John Tag: Why does CLick once insist on .net 3.5 Tag: 411216
Table name to table adapter
Hi
From a reference to a data table in a dataset can I reference the data
adapter associated with the table to execute data adapter's merge method?
Thanks
Regards Tag: Why does CLick once insist on .net 3.5 Tag: 411215
Array Problem When Index Value is Nothing
Hi all,
I ran into memory problems while tying to search and replace a very large
text file. To solve this I break the file up into chunks and run the search
and replace on each chunk. This works fine and has solved the OutOfMemory
problem.
However, on the last loop when the array c is written to CleanTMX, a number
of 0x00 characters are written at the end of the file. This causes problems
in a further XMLTransformation as this character is not allowed in XML. I
looked at the values of the index. Th eproblem seems to be caused by index
values at the end of the array being set to Nothing.
Question: How can I get rid of these characters? Or how can I reduce the
array to only contain index values that are not Nothing?
Here's the code that writes the CleanTMX file:
Dim c(My.Settings.ReadChunkSize) As Char 'ReadChunkSize is a user-defined
setting, normally set to 10000
Using sr As StreamReader = New StreamReader(OriginalTMX,
System.Text.Encoding.UTF8, True)
Do While sr.Peek() >= 0
sr.Read(c, 0, c.Length)
Dim i As Integer
For i = 0 To arrFind.Length - 1
c = Regex.Replace(c, arrFind(i), arrReplace(i))
Next
Try
Using sw As StreamWriter = New StreamWriter(CleanTMX, True,
System.Text.Encoding.UTF8)
sw.Write(c)
End Using
Catch ex As Exception
End Try
Loop
Would really appreciate any help on this one.
Thanx
Rob Tag: Why does CLick once insist on .net 3.5 Tag: 411213
Dealing with DBConcurrencyException error in multi-table scenario
Hi
I am handling DBConcurrencyException for an adapter manager using code
below. My problem is how to merge table in error with its copy from
underlying database. If I need the table's data adapter for the merge, can I
extract the data adapter at run time from the information I have viz adapter
manager, dataset and the table in error.
Thanks
Regards
Try
Me.TableAdapterManager.UpdateAll(Me.MyDataSet)
Catch ex As DBConcurrencyException
For Each MyTable In MyDataSet.Tables
If MyTable.HasErrors Then
' How do I merge MyTable with the database copy of
itself here?
End If
Next
End Try Tag: Why does CLick once insist on .net 3.5 Tag: 411212
Stupid Question..Maybe
I had a random thought today. Is it possible to make a complete application
with several forms that contain databound info such as textboxes or
dataGridViews and use 1 and only 1 dataset for the entire application?
I ask because, when I created my program, for each and every form that has
databound information, there is a dataset that is created.
Now, correct me if I'm wrong, but when a tableAdapter, or DataTable is
associated with the dataset, doesn't that contact the dataSource (ie. DB on
server or remote location) during a fill(dtTableName) using excessive
bandwidth? I ask about the bandwidth issue because I have an application
that fills from the Products table of the database which contains over 6000+
records. I have 3 different forms that need to fill a tableAdapter from the
Products table of the DB. Couldn't I just use the ONE dataset that might be
Public to the entire app and grab the info from there. I understand that
when changes are made and saved, then they will be saved to the dataSource
which uses bandwidth but having to fill the info everytime I need to use a
table from the DB takes a while to load the records.
I hope to be schooled here since I mostly know about the drag and drop
methods shown from online tutorials from Microsoft's Webcasts page.
Unfortunately, I am using an Access DB on a mapped network drive but there
has to be an easier/faster way of retrieving the data I need, right?
Tony K. Tag: Why does CLick once insist on .net 3.5 Tag: 411209
validation not fireing on button press!
I have a button on the form which has causes validation set to true... when
I click on it not one of my validating events fires on the form... every
single control with it just skips over it and the button executes its
procedure without validation... now when i go to a control then tab off it
the validating event does fire... what in the world is going on here? im
lost... it never acted like this before.... this is VS2008 with .NET 3.5 Tag: Why does CLick once insist on .net 3.5 Tag: 411203
Looking for a free SFTP library for VB.NET
Can anyone recommend a free or open source Secure FTP (SFTP) library that
can be used from VB.NET?
I can see a number of commercial solutions but if there's a library we can
use without getting bogged down in licensing issues it would make things
much easier for me...
Many thanks,
--
(O)enone Tag: Why does CLick once insist on .net 3.5 Tag: 411202
Writing a simple webservice
Hi guys, I'm looking to develop a simple web service in VB.NET but I'm
having some trivial issues. In Visual Studio I create a web services
project and change the asmx.vb file to this:
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel
<System.Web.Services.WebService(Namespace:="http://
wwwpreview.#deleted#.co.uk/~ptaylor/Customer.wsdl")> _
<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)>
_
<ToolboxItem(False)> _
Public Class CustomerService
Inherits System.Web.Services.WebService
<WebMethod()> _
Public Function getCustomer() As TreeObject()
Dim t1 As New TreeObject
Dim t2 As New TreeObject
Dim t3 As New TreeObject
Dim arr(2) As TreeObject
arr(0) = t1
arr(1) = t2
arr(2) = t3
Return arr
End Function
End Class
As you can see my function returns an object of type "TreeObject" and
when you run this it works. the clients are clearly returned an array
3 TreeObjects objects. However I cannot actually invoke any functions
on these tree objects. This is the current definition of TreeObject:
Imports System.Web.Services
<System.Serializable()> _
Public Class TreeObject
Public Sub New()
End Sub
<WebMethod()> _
Public Sub setId(ByVal id As Int32)
End Sub
<WebMethod()> _
Public Function getId() As String
Return 1
End Function
<WebMethod()> _
Public Sub setName(ByVal value As String)
End Sub
<WebMethod()> _
Public Function getName() As String
Return "boo ya"
End Function
End Class
However the functions GetName, SetName, GetId, SetId do not appear in
the WSDL file and the functions are not accessable from the client. (I
think TreeObject has no functions other than those inherited from
Object)
How do I make those functions accessible please? Do I need to set up
another "service" or what?
Thanks
Phill Tag: Why does CLick once insist on .net 3.5 Tag: 411197
Scrolling when doing a drag and drop in TableLayoutPanel (VS2005)
Hello,
I am trying to drag and drop a label control from one cell in a
tablelayoutpanel to another (VB2005). There is no problem if both
cells are visible, but i cannot get the tablelayoutpanel to scroll in
any direction (autoscroll is on), when the cell i want to drag to is
no currently visible and requires scrolling to get to see it.
Any suggestions would be greatly appreciated.
I have also noticed that my middle mouse scrollwheel no longer works
for my tablelayoutpanel. Weird as it worked when i first started
developing the form, but now the TLP is on a panel, it no longer
works. Is this normal?
Thanks so much,
Jeff Tag: Why does CLick once insist on .net 3.5 Tag: 411195
Screen Casting
Does anyone know if there are any controls available that enable
screencasting. I would like to design an app which allows a user to do a
screencast to other users. Regards, Chris. Tag: Why does CLick once insist on .net 3.5 Tag: 411194
HELP!!!!! MSBUILD : error : INTERNAL CONSOLE LOGGER ERROR
MSBUILD : error : INTERNAL CONSOLE LOGGER ERROR. Project frame C:
\Documents and Settings\tom\Local Settings\Temp\vs3BF.tmp expected,
but was C:\DEVELOPMENT\VS2005\Dotnet\ASD Libraries
\AdvancedSoftwareDesigns.Windows.Forms
\AdvancedSoftwareDesigns.Windows.Forms.vbproj.
This error just started occurring. It happens in several projects and
now my key gui app is falling over right in the middle of the build.
Anyone have any idea what this means? Tag: Why does CLick once insist on .net 3.5 Tag: 411192
Developing a selection program
Hi group,
I have been given the task at work of producing a selection frogram
for a range of our air handling units. I have a little experience of
programing in VB 6 from many years ago, but would like to try and
attempt this in VB.net and make as good a job as possible of it. The
application will be required to output schedules and reports in both
Excel and Word documents . What I am asking is, has anyone done
anything like this and could give me some advice on how to go about
it. I have bought a few well reviewed books but have not come across
any mention of Word or Excel documents being prduced in VB.net. Any
advice, tips or alternative coding language to use will be gratefully
received.
Thank you.
Adrian. Tag: Why does CLick once insist on .net 3.5 Tag: 411186
Why can't we disable a tab page?
Most of the basic UI controls have Enabled property. I know we can't
disable a specific tab page, but why is it so? What is the rationale?
I don't think Microsoft developers designed that way because they
couldn't implement it. Tag: Why does CLick once insist on .net 3.5 Tag: 411183
Context & Property Shell Extensions
Does anyone have any point of source on how to create context meny and
property tabs shells extensions in VB.net?
My intention is to integrate my program with jpg and bmp extensions and be
able to display a custom menu on the contextual menu of these filetypes.
I know they have to be registered in the registry with a guid and point to a
dll but i have no idea on how to develop those in .net
Thanks for the help. Tag: Why does CLick once insist on .net 3.5 Tag: 411182
DataGridView locks up application
I have a DataGridView that I NEED to display the data that is scanned with a
barcode.
The columns are:
Product Number Description Location Units On Hand Untis Scanned
Min On Hand Max On Hand
All columns are retrieved from the database except Units Scanned. That is
calculated by the # of times the operator scans a barcode.
The code I use for filling the DataGridView is:
Private Sub ReceiveData(ByVal msg As String)
' Receive strings from a serial port.
CheckForIllegalCrossThreadCalls = False
Dim cnnInventory As OleDbConnection
Dim dgvRow(7) As String
Dim cmmInventory As OleDbCommand
Dim dadInventory As OleDbDataAdapter
Dim dtbInventory As DataTable
Dim cmmUnitsOnHand As OleDbCommand
Dim dadUnitsOnHand As OleDbDataAdapter
Dim dtbUnitsOnHand As DataTable
Dim intCounter As Integer, prodID As Integer
'Instantiate and open the connection
cnnInventory = New
OleDbConnection(My.Settings.Inventory_management_databaseConnectionString)
cnnInventory.Open()
'Instantiate the command datatable
cmmInventory = New OleDbCommand("SELECT * FROM Products",
cnnInventory)
dtbInventory = New DataTable()
'Instantiate and initialize the data adapter
dadInventory = New OleDbDataAdapter("SELECT * FROM Products",
cnnInventory)
dadInventory.SelectCommand = cmmInventory
'Fill the data table view
dadInventory.Fill(dtbInventory)
'Filter the data table view
dtbInventory.DefaultView.RowFilter = "ProductIDNumber = '" & msg &
"'"
prodID =
CType(dtbInventory.DefaultView(0).Row("ProductID").ToString, Integer)
dgvRow(0) = msg
dgvRow(1) =
dtbInventory.DefaultView(0).Row("ProductDescription").ToString
dgvRow(2) =
dtbInventory.DefaultView(0).Row("ProductLocation").ToString
dgvRow(5) = dtbInventory.DefaultView(0).Row("ReorderLevel").ToString
dgvRow(6) =
dtbInventory.DefaultView(0).Row("MinimumRequired").ToString
'Instantiate the command datatable
cmmUnitsOnHand = New OleDbCommand("SELECT SUM(UnitsReceived) -
SUM(UnitsSold) - SUM(UnitsShrinkage) AS UnitsOnHand " & _
"FROM [Inventory Transactions] WHERE (ProductID = " & prodID
& ")", cnnInventory)
dtbUnitsOnHand = New DataTable
'Instantiate and initialize the data adapter
dadUnitsOnHand = New OleDbDataAdapter("SELECT SUM(UnitsReceived) -
SUM(UnitsSold) - SUM(UnitsShrinkage) AS UnitsOnHand " & _
"FROM [Inventory Transactions] WHERE (ProductID = " & prodID
& ")", cnnInventory)
dadUnitsOnHand.SelectCommand = cmmUnitsOnHand
'Fill the data table view
dadUnitsOnHand.Fill(dtbUnitsOnHand)
'Filter the data table view
'dtbUnitsOnHand.DefaultView.RowFilter = "ProductID = " & prodID
For intCounter = 0 To dtbUnitsOnHand.DefaultView.Count - 1
dgvRow(3) =
dtbUnitsOnHand.DefaultView(0).Row("UnitsOnHand").ToString
Next
Me.DataGridView1.Rows.Add(dgvRow)
cnnInventory.Close()
End Sub
For each barcode ProductIDNumber scanned, it retrieves the description,
location, unitsOnHand, minOnHand, maxOnHand.
Problems: When the # of rows exceed the amount displayed, the applications
seems to freeze. Example: I have a maximum of 20 rows that can be
displayed at once, when I have entered 21 different items or more, then try
to scroll on the vertical scroll bar, the application freezes and nothing
else happens. Sometimes the scrollbar is not even displayed but instead it
looks like a bunch of little grid cells.
I have the properties set to show the vertical scroll bar.
There is not a DataSource associated with the DataGridView.
Why does it lock up when there are more rows added than displayed??
Thanks,
Tony K. Tag: Why does CLick once insist on .net 3.5 Tag: 411180
Objects raising events after "reinstantiation"
I've run into this problem a couple of times when creating objects that raise
events but I've always been able to code around it so I never asked the
question. I'm using a Process object with .EnableRaisingEvents turned ON and
.BeginOutputReadLine() so that I can process the output as it is generated
from my process.
The scenario for use is that this executable uses an .ini file that contains
some settings with one of them being a path to an input file that will be
scrubbed. This executable has a known issue in that only 1000 or so entries
can be processed reliably during one "run" otherwise strange results occur if
there are more. My use case provides that I will often have cases where I
need to process 1000+ entries so my plan was to split however many entries
into files of 1000 lines each and the whenever the Process.Exited event is
fired when the executable finishes running, I would modify the .ini file to
point to one of the other input files, re-start the process however many
times I need to in order to process all my input.
The problem lies in that after the first run, the Process does not raise
events anymore for .OutputDataReceived but I am not re-instantiating the
Process object in my class so I'm not sure why I cannot continue to capture
events when I am in essence just re-starting the process with all the same
properties turned on.
FYI I do not have the code for this picky executable program either so
please do not give any lame answers in that vein...I'm interested in how
events are raised when objects die out and are re-instantiated or the context
I've described above. Also I am calling Process.CancelOutputRead() in the
Exited event and then calling Process.BeginOutputReadLine() after I re-start
it so I don't believe this is the problem either.
Thanks in advance. Tag: Why does CLick once insist on .net 3.5 Tag: 411175
Databind DataGridView to List(of String)
I use the following code to programmatically bind a DataGridView and a
BindingNavigator to various List(of myClass). This works fine with each
'myClass' offering public properties.
Dim mAllUsers As List(Of myClass)
mAllUsers = GetAllUsers() 'returns List(Of myClass)
Dim AllUsersBindingSource As New BindingSource(Me.components)
ControlStationInfoBindingNavigator.BindingSource = AllUsersBindingSource
ControlStationInfoDataGridView.AutoGenerateColumns = True
ControlStationInfoDataGridView.DataSource = AllUsersBindingSource
AllUsersBindingSource.DataSource = mAllUsers
If I change the code to
Dim mAllUsers As List(Of String)
mAllUsers = GetAllUsers() 'returns List(Of String)
then the DataGridView only displays one column containing the length of each
string.
I want only to display the strings in one column.
thank you very much, herbert Tag: Why does CLick once insist on .net 3.5 Tag: 411174
problem with checking null or empty value in detailsview
Hi,
i want to check whether the textbox of the detailsview is not left empty, in
insert mode.
I did this:
Protected Sub DetailsView1_ItemInserting(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DetailsViewInsertEventArgs) Handles
DetailsView1.ItemInserting
Dim h As String
h = e.Values("myfield")
'If h = "" Then
If h Is Nothing Then
e.Cancel = True
Label1.Text = "may not be empty."
End If
End Sub
I tried two ways (with ="" and with is nothing), but in both cases, i always
get the label text and the event is always cancelled, even when i full some
value.
So, what's wrong with this code?
Thanks
Bob Tag: Why does CLick once insist on .net 3.5 Tag: 411170
Thumbnail Images in Listview (Please Help..)
I am trying to show many Images in a Listview controls with size(100,100).
But some of the images sizes are big, like width=238 and height 50. These
images does not appear proper in the listview control.
What do I need to do to see the Images same as I am looking using windows
explorer thumbnail.
Please help me as I am stuck on this for almost two days now.
Thanks for any help you can provide.
Mark Tag: Why does CLick once insist on .net 3.5 Tag: 411168
Moving character Glyphs
I modified a C# application from Bob Powell that moves graphics primitives
around on the screen into a Vb.NET 2005 application. I want to modify this
application so along with moving regular geometric shapes, I can also move
the alphanumeric characters as well. For example I place the character "A" on
the screen and when I point to it with the mouse the character will be
outlined and while holding down the left mouse button move the "A" somewhere
else on the screen.
Since I learn best by example I wrote another class for the Characters, but
it doesn't work. I asked Bob Powell and he suggested I convert the characters
to glyphs and hit test these, but since VB.NET's only resembalance to the
Visual Basic programming language is in name only I'm now completely lost.
Here is the Class I wrote:
Public Class DrawText
Inherits Primitive
Public Sub New()
MyBase.New()
End Sub
Public Overloads Overrides Sub Draw(ByVal g As Graphics)
Dim b As New SolidBrush(Me.Color)
Dim txt As String = "Aa"
'Dim big_font As New Font("Times New Roman", 30, FontStyle.Bold)
'g.TextRenderingHint =
Drawing.Text.TextRenderingHint.AntiAliasGridFit
'g.DrawString(txt, big_font, Brushes.Black, 10, 100)
'g.FillRectangle(b, New Rectangle(Me.Location, Me.Size))
'b.Dispose()
'Create a GraphicsPath
Dim graphics_path As New Drawing2D.GraphicsPath
'Add some text to the path
graphics_path.AddString(txt, _
New FontFamily("Times New Roman"), _
CInt(FontStyle.Bold), _
80, New Point(10, 100), _
StringFormat.GenericTypographic)
g.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias
g.FillPath(Brushes.White, graphics_path)
g.DrawPath(New Pen(Drawing.Color.Black, 3), graphics_path)
b.Dispose()
If Highlight Then
Dim p As New Pen(Drawing.Color.Red, 3)
p.DashStyle = Drawing2D.DashStyle.DashDot
g.DrawRectangle(p, New Rectangle(Me.Location, Me.Size))
p.Dispose()
End If
End Sub
Public Overloads Overrides Function HitTest(ByVal p As Point) As
Boolean
Dim pth As New Drawing2D.GraphicsPath()
pth.AddEllipse(New Rectangle(Location, Size))
Dim retval As Boolean = pth.IsVisible(p)
pth.Dispose()
Return retval
End Function
End Class
Can someone tell me what I'm doing wrong?
--
Mark Tag: Why does CLick once insist on .net 3.5 Tag: 411161
Resizing an arraylist
I have an arraylist of for example 1200. I want to re organize the
array so that position 1 on the arraylist if actaully now position 3
and i want to add 3 position before position 3 and at the end of the
arraylist. Can i use the Redim statement? Tag: Why does CLick once insist on .net 3.5 Tag: 411158
What is the most efficient way ...
Does anyone know an efficient way to generate sound tones in Visual
Basic 2005/2008 so that I can specify:
- Pitch
- Duration
- Volume
... which uses the computer's soundcard (not the motherboard
speaker).?
From what I've seen, DirectX may be the only solution but even that
seems extremely cumbersome. I'm amazed that Visual Basic doesn't have
an easy way to do this. It was a lot easier on my Apple //c!
Thanks for any suggestions. Tag: Why does CLick once insist on .net 3.5 Tag: 411155
How to change the amount into -ve in CR ?
This is a multi-part message in MIME format.
------=_NextPart_000_1D68_01C8AEDF.7E9CE290
Content-Type: text/plain;
charset="big5"
Content-Transfer-Encoding: quoted-printable
if {tmp_csinvinfo_os.debit}-{tmp_csinvinfo_os.credit} > 0 then
{tmp_csinvinfo_os.netbaseamt}
else=20
({tmp_csinvinfo_os.netbaseamt} *(-1)
the above code can't return the -ve value , how can i change the value =
into -ve ???
Thanks a lot
------=_NextPart_000_1D68_01C8AEDF.7E9CE290
Content-Type: text/html;
charset="big5"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; charset=3Dbig5">
<META content=3D"MSHTML 6.00.2900.3314" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3D"Palatino Linotype" size=3D2>if=20
{tmp_csinvinfo_os.debit}-{tmp_csinvinfo_os.credit} > 0=20
then<BR>{tmp_csinvinfo_os.netbaseamt}<BR>else=20
<BR> ({tmp_csinvinfo_os.netbaseamt} *(-1)</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3D"Palatino Linotype" size=3D2><BR>the above code can't =
return the=20
-ve value , how can i change the value into -ve ???<BR>Thanks a=20
lot<BR> </FONT></DIV></BODY></HTML>
------=_NextPart_000_1D68_01C8AEDF.7E9CE290-- Tag: Why does CLick once insist on .net 3.5 Tag: 411153
Conferencing Control
Hi I want to create a very basic conferencing functionality. Are there any
controls that allow VOIP conferencing, preferably something cheap. The
simpler the better as I am a asp.net developer and new to winforms. Tag: Why does CLick once insist on .net 3.5 Tag: 411148
query that will return null values to 0
i'm using mySQL as my backend to my program. i know this is not VB.NET
anymore but i don't know how to do it. i have a query that will calculate if
it satisfies the condition. it goes like this:
SELECT
(tblseedsubsidy.NoOfBags)
FROM
agri.tbltrcclient
INNER JOIN agri.tblseedsubsidy
ON (tbltrcclient.ClientID = tblseedsubsidy.ClientID)
INNER JOIN agri.tblinventory
ON (tblseedsubsidy.SeedID = tblinventory.SeedID)
WHERE (tblseedsubsidy.CoOwner = '1'
AND tbltrcclient.TypeofSeed = 'Corn')
HAVING (sum(tblseedsubsidy.NoOfBags) /2);
but every time it doesn't satisfy the condition where CoOwner must be equal
to '1' it returns a null value. how can i convert the null value into 0?
if anyone has any idea on how to do it i would really appreciate it. thanks.
--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/Forums.aspx/dotnet-vb-net/200805/1 Tag: Why does CLick once insist on .net 3.5 Tag: 411147