|
Yup...
<br />
Font fArial = new Font("Arial", 10.0f, FontStyle.Bold, GraphicsUnit.Pixel);<br />
SizeF stringSize = Graphics.MeasureString("W", fArial);<br />
Console.WriteLine("String width is : {0}", stringSize.Width.ToString());<br />
Note : The code above is .NET (C#) code, not VBA
|
|
|
|
|
That's really helpful.
Thanks a lot.
|
|
|
|
|
hi, i'm new in this. i've been doing a prgm using vb.net with asp.net and it's working when i run it in my local pc. but, when i deploy it to my server the database r pointing to my local pc. i've check my web config and my coding. but all are written to point to the server dbase. help me pls..
|
|
|
|
|
Well, first of all, we have an ASP.NET forum.
zaimah wrote: but, when i deploy it to my server the database r pointing to my local pc.
Then your code is pointing to your local PC. There's no two ways around it. How do you know it's pointing to the wrong place ? What makes you think you've set it to point elsewhere ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
sorry, wrong forum. i know it's pointing to the wrong place bcoz, in my web.config i put server name n dbase. i delete my dbase at my local pc. when i run the prgm tell me my table name is invalid. but when i create th dbase in my local pc and delete the dbase in the server, it shows whatever inside the dbase in the local pc. eventhough in my web.config and my coding r written the server name n database. it's very confusing.
|
|
|
|
|
Might your website be using a cached web.config ? Why can it see the DB on your local machine at all ? Can you add some data to the server DB to confirm it's not being read ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
what is a cached web.config? rite now i'm at my local pc. i connect the server from my local pc. i can add data but it goes to my local DB. this is weird. maybe i did a mistake, but i dont know where to find the mistake bcoz i already check the web.config n my coding in other files. this is my first time doing a prgm.
|
|
|
|
|
zaimah wrote: this is my first time doing a prgm.
Well, what a disaster. Why on earth would your first ever program be a web app, with config files to set up, and a database ? Walk before you run.
Having said that, perhaps if you posted what's in your web config, I could point out what's wrong with it ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
If you happened to use the Database Wizard to configure any part of your application, then Visual Studio may haved added code throughout your project making reference to the local copy of the database.
An easy way to locate local pointers to your database is to open up Visual Studio and then open the find dialog and search for the filename of the database in the entire solution.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
Hello!
I am able to control any buttons on gamepad within my vb.net code. But I also want to vibrate the gamepad. I am not using XNA but just directinput in my code. There are several properties and events that associated with the directinput. I realized that there is a SendHardwareCommand function. It is requiring two patameters as shown below. I couldn't figure out the 2nd parameter. I wonder what does it do? Is it the function that I should use for vibration?
GamePadDevice.SendHardwareCommand (Command as Int32, Data() as Byte)
If you acknowledge me, I appreciate.
Thanks.
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
|
I am writing a program that shows a listbox with the name of 5 bitmap images to pick from. This program will allow the user to pick one for each 16 pictureboxes on the next form. When the user is done, he will push a button and another form pops up and shows 16 pictureboxes with the images he selected for each.
I have the 16 pictureboxes and a working listbox but due to lack of experience using windows forms in visual basic, I don't know how to take the selection from the listbox and use an if statement to tell the second form what to print inside the box.
For example, it would look something like this:
if form1.listbox1.selection = red car
then form2.picturebox1.image = redcar.png
This doesn't work, obviously, but you see what I am trying to do.
Any ideas?
-Live long and prosper
|
|
|
|
|
I assume that you need the name of selected item in the listbox such as (red car, Purple car, etc.) and your aim is to use these values on both forms. All you need is a Global variable what will keep the selected item of Listbox. Then you can use this variable to call the values from form1. Here is a brief example.
<br />
<br />
Public MySelectedItem as String 'Define this out of a procedure or function<br />
<br />
<br />
FORM1<br />
<br />
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click<br />
Dim I as Int32 = Nothing<br />
MySelectedItem = Listbox1.SelectedItems.Item(I) <br />
End Sub<br />
<br />
FORM2<br />
<br />
Select Case MySelectedItem<br />
<br />
Case "Red car"<br />
Form2.PictureBox1.Image = image.fromfile("Redcar.png")<br />
Case "Purple car"<br />
<br />
End Selection<br />
<br />
<br />
I hope that helps
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
Everything seems to work ok except this one thing......
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim I As Int32 = Nothing
MySelectedItem1 = ListBox1.SelectedItems.Item(I)
MySelectedItem2 = ListBox2.SelectedItems.Item(I)
MySelectedItem3 = ListBox3.SelectedItems.Item(I)
MySelectedItem4 = ListBox4.SelectedItems.Item(I)
Dim y As New Form2
Dim x As New Form3
x.ShowDialog()
y.ShowDialog()
End Sub
Error message says:
IndexOutOfRangeException was unhandled
Index is out of bounds of the array
The error points to the MySelectedItem1 = ListBox1.SelectedItems.Item(I)
-Live long and prosper
|
|
|
|
|
Use a delegate, not a global. If form2 is a child of form1, you don't even need a delegate, just expose a method on the form, assuming it's modeless.
NEVER expose a control on the second form, expose a property that sets a property of the control.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
By exposing a control, you mean that I shouldn't allow the user to interact with it? All that I intend to do with the second form is to allow the user to see 16 small windows with pictures of cars in them.
-Live long and prosper
|
|
|
|
|
I mean if form1 has a listbox called lb1, NEVER make it public. Always expose no more functionality to other classes than you need to.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi Friends,
I have an one .Net windows application setup project which consist for following files.
1.Setup.exe
2.Setup.msi
3.sample.txt
My question is, how to get sample.txt file when installing the setup file?. Because i will be refer from some criteria in sample.txt file.
Urgent
Thanks in advance
Rameshkumar Thirumalaisamy
|
|
|
|
|
Windows.Forms.Application.StartupPath & "\" & "sample.txt"
Shay Noy
|
|
|
|
|
I am new to programming with databases. Any and all help will be very much appreciated. Thank you in advance.
I am writing an application that connects to an access database (4000 records). The database tracks boxes in a small warehouse. The box numbers are the primary key. Fields include the room number, store date, disposal date, section, shelf number.... I have successfully created a form with separate text boxes for each field. I can connect to the database and load the data into a DataSet. I can search the database by entering a box number and all of the text boxes update with the correct information. I can move forward or backwards one box at a time. The problem I am having is updating the database. Like I said, I'm new to this part of programming. I should never need to insert a line into the database, but I will most definately need to update a line. (One field is a y/n, y if the box is available for a new record.) The app will search for the first 'y' in the field and assign the user with the box number. The user will input the required info and save to the database.
Once again, I need to be able to update a line in an Access database. There is only one table.
I hope I have described this well enough to get some help. Thank you again!
Chuck
|
|
|
|
|
You need to do an Update SQL statement as following:
if you use a connection object:
con.execute "Update YourTable SET YourField= YourValue WHERE..."
if you use a database object:
db.execute "Update YourTable SET YourField= YourValue WHERE..."
Shay Noy
|
|
|
|
|
I believe I'm using a connection object. I don't really know the proper terminology. Here is a bit of my code.
Dim myConnectionString as String = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=I:AccessDB.mdb"
Dim myConnection as new OleDb.OleDbConnection(myconnectionString)
---ONLOAD---
myConnection.open()
OleDbDataAdapter1.Fill(Dataset11)
And so on...
I take it this is a Connection object?
I have tried using MyConnection.execute but this doesn't work.
I'm not finding the ".execute" anywhere. Is there some Inherits that I'm missing? The only thing I'm Inherting at the moment is System.windows.forms.form
I'm sorry if I sound a little uneducated. This is the first serious application I've attempted and unfortunately my Associates in Programming probably wasn't worth the education I received. Thanks again.
|
|
|
|
|
Read up on the Update method of the OleDbDataAdapter
Steve Jowett
-------------------------
It is offen dangerous to try and see someone else's point of view, without proper training. Douglas Adams (Mostly Harmless)
|
|
|
|
|
Hello every one
Is there any way how we can differentiate between the close click, in the control box and me.close call
My objective is...
I want the user to be able to minimize the form not to close it. When i handle it in form closing event i am not able to differentiate between me.close & lose clicked..
Regards
Nishkarsh
|
|
|
|
|
hi,
handle formClosing Event of Form which you want to minimize and write following statement
e.Cancel = True<br />
Me.WindowState = FormWindowState.Minimized
hope this helps
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
My Company
|
|
|
|