|
hello friends
i need help for using unicode & ASCII code using in vb-6
for language conversion and enabling right-to-left language
conversion code e.g. English to Arabic or induan punjabi
Charactor conversion or designing Arabic & punjabi Controls
or formats
zain
|
|
|
|
|
hi friends
i need help for call .lib & .cab files in visual basic-6 projects
zain
|
|
|
|
|
You don't makes calls into these types of files. A .lib file is something C/C++ gets compiled with and a .cab file is a compressed "cabinet" file, like a .ZIP file.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi !
I need to write a VBScript which would launch a command application (nmake, not to name it) and I'd like that the output produced by nmake being displayed in the command window from where I launched the VB Script.
I did some googling but didn't find anything which works...
Any idea ?
Thanks !
Jerome
|
|
|
|
|
I add a system.data .net reference in project , and use these code in a winform.
imports system.data
Dim theData As DataTable
^^^^^^^^^ ---- Error!
Why?
|
|
|
|
|
Did you add a reference to system.data.dll in the solution explorer?
|
|
|
|
|
I tried to set the printpreviewdialog.showdialog to fullscreen,including set top=0, left=0, width=screen....width,height=screen...height.
However,the top is always not 0 acturally.
Why?
|
|
|
|
|
have you tried to set the windowstate property?
Briga
Dim a As PrintPreviewDialog
Public Sub test()
a.WindowState = FormWindowState.Maximized
End Sub
|
|
|
|
|
I have tried out various code on capturing keypress and doubleclick events on the datagrid. But the problem is when you add the keypress support, the doubleclick won't fire out.
here is the code for trapping double click
Dim grdColStyle1As New DataGridKeyTrapTextBoxColumn
grdColStyle1.MappingName = "Acc_Curr_Balance"
grdColStyle1.HeaderText = "Account Balance"
grdColStyle1.Width = 225
AddHandler grdColStyle1.TextBox.MouseDown, New MouseEventHandler(AddressOf TextBoxMouseDownHandler)
AddHandler grdColStyle1.TextBox.DoubleClick, New EventHandler(AddressOf TextBoxDoubleClickHandler)
Private Sub TextBoxMouseDownHandler(ByVal sender As Object, ByVal e As MouseEventArgs)
If (DateTime.Now < gridMouseDownTime.AddMilliseconds(SystemInformation.DoubleClickTime)) Then
btnOk_Click(sender, e)
End If
End Sub
Private Sub TextBoxDoubleClickHandler(ByVal sender As Object, ByVal e As EventArgs)
Try
btnOk_Click(sender, e)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
' trap the key press
Public Class DataGridKeyTrapTextBoxColumn
Inherits DataGridTextBoxColumn
Private _keyTrapTextBox As KeyTrapTextBox = Nothing
Private _source As System.Windows.Forms.CurrencyManager = Nothing
Private _rowNum As Integer
Private _isEditing As Boolean = False
Public Shared _RowCount As Integer = 0
Private mTxt1 As String
Private mTxt2 As String
Private mTxt3 As String
Private mClicked As Boolean = False
Public Sub New()
_keyTrapTextBox = New KeyTrapTextBox
_keyTrapTextBox.BorderStyle = BorderStyle.None
AddHandler _keyTrapTextBox.Leave, AddressOf LeaveKeyTrapTextBox
AddHandler _keyTrapTextBox.KeyPress, AddressOf TextBoxEditStarted
End Sub 'New
Private Sub TextBoxEditStarted(ByVal sender As Object, ByVal e As KeyPressEventArgs)
_isEditing = True
'dim cm as CurrencyManager =
'If e.KeyChar = Chr(13) Then
' MsgBox(CType(sender, TextBox).Text)
'End If
MyBase.ColumnStartedEditing(CType(sender, Control))
End Sub 'TextBoxEditStarted
Private Sub LeaveKeyTrapTextBox(ByVal sender As Object, ByVal e As EventArgs)
If _isEditing Then
SetColumnValueAtRow(_source, _rowNum, _keyTrapTextBox.Text)
_isEditing = False
Invalidate()
End If
_keyTrapTextBox.Hide()
End Sub 'LeaveKeyTrapTextBox
Protected Overloads Overrides Sub Edit(ByVal [source] As System.Windows.Forms.CurrencyManager, ByVal rowNum As Integer, ByVal bounds As System.Drawing.Rectangle, ByVal [readOnly] As Boolean, ByVal instantText As String, ByVal cellIsVisible As Boolean)
_RowCount = [source].Count
MyBase.Edit([source], rowNum, bounds, [readOnly], instantText, cellIsVisible)
_rowNum = rowNum
_source = [source]
_keyTrapTextBox.Parent = Me.TextBox.Parent
_keyTrapTextBox.Location = Me.TextBox.Location
_keyTrapTextBox.Size = Me.TextBox.Size
_keyTrapTextBox.Text = Me.TextBox.Text
Me.TextBox.Visible = False
_keyTrapTextBox.Visible = True
_keyTrapTextBox.BringToFront()
_keyTrapTextBox.Focus()
'sets the textbox values
End Sub 'Edit
Protected Overrides Function Commit(ByVal dataSource As System.Windows.Forms.CurrencyManager, ByVal rowNum As Integer) As Boolean
If _isEditing Then
_isEditing = False
SetColumnValueAtRow(dataSource, rowNum, _keyTrapTextBox.Text)
End If
Return True
End Function 'Commit
End Class 'DataGridKeyTrapTextBoxColumn
Public Class KeyTrapTextBox
Inherits TextBox
Public Sub New()
Me.ReadOnly = True
End Sub 'New
Private Const WM_KEYDOWN As Integer = &H100
Private Const WM_KEYUP As Integer = &H101
Private Const WM_CHAR As Integer = &H102
Public Overrides Function PreProcessMessage(ByRef msg As Message) As Boolean
Dim keyCode As Keys = CType(msg.WParam.ToInt32(), Keys) And Keys.KeyCode
If msg.Msg = WM_KEYDOWN Then
Console.WriteLine(("TextBox.WM_KEYDOWN key: " + keyCode.ToString()))
End If
' for a datagrid, we need to eat the tab key oe else its done twice
If msg.Msg = WM_KEYDOWN AndAlso keyCode = Keys.Tab Then
'to ignore a message return true without calling baseclass
'to let the textbox handle message return false;
'don't let textbox handle tab
Return True
End If
Return MyBase.PreProcessMessage(msg)
' //sample handling code. This lets the textbox handle the delete
' //& preventing (for example) a delete shortcut on a menu getting it
' if((msg.Msg == WM_KEYDOWN)
' && keyCode == Keys.Delete)
' {
' //to ignore a message return true without calling baseclass
' //to let the textbox handle message return false;
'
' //let textbox handle Delete
' return false;
' }
'Return MyBase.PreProcessMessage(msg)
End Function 'PreProcessMessage
End Class 'KeyTrapTextBox
pls can anybody help me to sort this out?
samitha
|
|
|
|
|
I am using sqlconnection control in vb.net and i use it for different form.
Everytime if i move my database and my application to other Computer, I need to change the connection string one by one in each form and of course this is abit troublesome for me.
Any ways to change the sqlconnection string in properties only 'once', and all sqlconnection string in all forms will also change?
|
|
|
|
|
Hey Buddy you must use app.config file. If you do need an example i will provide you ok. Wait
Bye...
Muhammad Waqas Butt
waqasb4alll@yahoo.com
|
|
|
|
|
I would love to see the example.
Sorry for double posting thread
|
|
|
|
|
Here is Code Buddy...
First add App.config file into your project.
[1] Add below code in the App.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="constr" value="data source=SK-WAQASBUTT;initial catalog=Northwind;user id=waqas;Password=butt" />
</appSettings>
</configuration>
How to get the key value. code is:
First add system.configration; reference is the file. then add this code on you button click.
try
{
string consetting = ConfigurationSettings.AppSettings["constr"]; // Get the Key value from app.config.
// I'm not good in VB.Net but still a try In VB.Net get key value could like this
// String consetting As ConfigurationSettings.AppSettings["constr"]
txtconstr.Text = consetting;
}
catch(Exception ex)
{
MessageBox.Show("Exception : " + ex.Message,
"Muhammad Waqas Butt",
MessageBoxButtons.OK,
MessageBoxIcon.Information);
}
}
See how simple is to do.
Ok please inform me if any problem occure in this code ok
<b>Muhammad Waqas Butt:->
waqasb4all@yahoo.com</b>
|
|
|
|
|
I am using sqlconnection control in vb.net and i use it for different form.
Everytime if i move my database and my application to other Computer, I need to change the connection string one by one in each form and of course this is abit troublesome for me. Any ways to change the sqlconnection string in properties only 'once', and all sqlconnection string in all forms will also change?
|
|
|
|
|
This is a frightening window into how badly designed your application is. This sort of stuff should be stored in a config file.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I did that because every form need adapter if want to connection to sql. When i drag and drop the adapter and and set sql command, a sqlconnection1 will appear.
That's why every form will have sqlconnection1. When i use other pc and copy my application, then i need to change every sqlconnection string in each form. If possible i want to set it once and all sqlconnection1.connectionstring are changed.
|
|
|
|
|
You can't do that using the "Drag and Drop" controls. It's always been better to write your own SQL connection code. You'll have to replace these connection objects with your own code that reads what the connection string should be from a config file.
A better method would be to centralize all your SQL code into a seperate class. Then, each form could use the SQL methods you expose in this class to handle all the data. This is what is meant by the "data tier" in a multiple-tier application.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Damn - you said the same as I did, but a lot more politely. I need some sleep.....
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I was feeling particularly gracious today! It's about 10pm here now, so, that'll end in about 2 hours!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Welcome to the world of programming. We tend to write code rather than drag stuff onto a pretty designer.
Seriously, the IDE lets you do this, but it's crap. You should have a central class for data access, and ideally a connection object that is reused, or even a pool, depending on the app.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Im interested when you said using one class to declare sqlconnection. Can you give me example of using it.
I know im a beginner in any programming language and only VB.Net is my first programming language and I did using code to declare sql connection but i have difficulty on it and I finally ended up with using sqldataadapter.
|
|
|
|
|
If you have a class that contains a private static sqlconnection, and sets it to null, then you can create the connection when it's first used, which is called lazy initialisation ( create it the first time it's used, otherwise return it. ). Use a property to wrap this, and the IDispose/Finaliser pattern to make sure it's cleaned up.
Then all your data access code will be in this one class ( which is good design in general ) and therefore all use this one connection. If the app is distributed, then you should use some sort of connection pool if you can, no use having every user hold a connection they are not using. But this pattern works well for local databases with only one user.
Here[^] are the MSDN docs on SQLDataAdapter - how did you use it INSTEAD of SQLConnection ? How is the DataAdapter connecting to SQL Server ? It looks to me like this class needs a SQLConnection to work, that's certainly how I use it.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
hey!nice to meet you,everyone.you can call me bill.can we make friends?
recently i posted a problem on the forum and havenot had a better answer.i know i am not clever.but could you please help me a little more? my question is:how to serialize(save) object into database field(SQL Server)?for a instance:
<serializable()>_
public class employee
private _name as string
private _age as string
public property name() as string
get
return me._name
end get
set(byval value as string)
me._name=value
end set
end property
.........
then,i serialized(saved) them into file:
public sub save(byval emp as employee,_
byval filepath as string,byval overwrite as boolean)
dim mode as filemode
if overwrite then
mode=filemiode.create
else
mode=filemode.createnew
end if
dim fs as new filestream(filepath,mode)
dim bf as new binaryformatter()
bf.serialize(fs,emp)
fs.close()
end sub
excitedly,i succeed.but,how to serialize(save) them into database field(SQL Server)?i have tried for many times,but failed!(maybe add dataset as interface,but i don't know how to do).please help me.i'm worrying about it.thanks a lot!
good luck and make more money! bill(in forum's name is:maaaxwell)
|
|
|
|
|
I have created several Excel VBA procedures that create a new spreadsheet, query a SQL database, and create pivot tables around the data. I would like to create an Excel function that takes an integer parameter and creates the new spreadsheets. I was able to create an xla file but it will not allow the creation of a new spreadsheet from inside a function. Is there a way to do this without creating a full blown COM object instead of an Excel add-in?
|
|
|
|
|
Hi,
I'm actually trying to show the properties of an object (line) painted on a bitmap in a scrollable control when I click over the line itself.
here is my problem:
the line is "georeferenced", so I wrote a function to convert the mouse coordinates to "geo coordinates" and perform a hit test to select the line.
It actually works if i do not use zoom.
To zoom-in I use a variable "_ScalingFactor" which is incremented by 0.05 by the zoom-in command and which is used to define the bitmap size and the translating function.
so, when i click on the control to select the line, I obtain the coords of the control not the coords of the bitmap containing the lines (the bitmap is larger then the control).
as a consequence, my hit test to select a line fails...
basically i'd need to get the mouse coords over the bitmap not over the control that contains the bitmap itself.
any help is veeery appreciated
Ciao!
Fuel2Run
p.s. sorry for my poor english.
|
|
|
|