|
i try to code in web application, i mean 'code behind'. but it doesnt display anything when i click on items
slect = lstmilestone.selectedITem.Value
stSQL="select staffid, lastname, firstname, email "
stSQL &=" from staff "
stSQL &=" where staffId = " & slect
try
mlstonecommand = new oledb.oledbcommand()
with mlstonecommand
.connection = new oledb.oledbconnection(connstr)
.connection.open()
.commandText = stSQL
lstoneDreader = .ExecuteReader(ComandBehavior.SingleRow)
End with
if mlstoneDreader.Read()
with mlstoneDreader
txtid.text = .item("staffID").tostring
txtmlname.text = .item("Firstname").Tostring
txtdesc.text = .item("LastName").ToString
End if
could anyone help me to figure out the problems.
thanks in advance
|
|
|
|
|
Hi, first of all sorry for my bad english as I am brazilian...
I want to know how to do something i was very used to in Vb6: custom types that has custom types in it , like in:
Public Type LowerLevel
Dim Value(1 to 100) as integer
End type
Public Type UpperOne
Dim UnderOneLevel (1 to 1000) as LowerLevel
End Type
public MyVariable(1 to 10) as UpperOne
By doing so, I was able to use the variable Myvariable(1 to 10).UnderOnelevel(1 to 1000).Value(1 to 100)... So i could type:
Myvariable(1).UnderOnelevel(555).Value(32) = 123 with no problems at all
Now the Big VB.Net question: How do I do that in .net?
It´s not as simple as it seems, because the structure (that substitutes "type" in .net") cannot have the "arrays" of integer with a declared size in the structure, so:
Public Structure LowerLevel
friend Value(100) as integer
End type
would be invalid because of the "100" in it. Anyway,
Public Structure LowerLevel
friend Value() as integer
End type
would be OK.
Now my example:
Public Structure LowerLevel
friend Value() as integer
End Structure
Public Structure UpperOne
Dim UnderOneLevel () as LowerLevel
End Structure
public MyVariable(10) as UpperOne
It compiles ok in VB.net.... But what if I need 1000 Underonelevel´s and 100 values in each????
The only possible way I could get it to work was the ugliest one:
public x ,y ,z as integer
for x = 1 to 10
redim myvariable(x).underonelevel(1000)
next x
for y = 1 to 10
for x = 1 to 1000
redim myvariable(y).underonelevel(x).value(100)
next x
next y
Why did I do it?
I noticed if I only declare something like:
redim Myvariable(10).underonelevel(1000)
redim Myvariable(10).underonelevel(1000).value(100)
I will only have created 100 "values" in Myvariable.underonelevel(1000),
so Myvariable(10).underonelevel(1000).value(55) would be valid
in the other hand
i wont have 100 "values" in any other "underonelevel" so
Myvariable(10).underonelevel(999).value(55) would not be valid because in Myvariable(10).underonelevel(999) it was not declared how many "values" the variable should have
Similarly, so Myvariable(9).underonelevel(1000).value(55) would not be valid because of the nine... and so on...
Anyway it could be done like in the "old" Vb6????
Do I really need all this code(and time, it took me 30 seconds to init the app)???
Hope someone can help me!
Thanks in advance!
Patrick Goettert
|
|
|
|
|
I am porting a VB .Net Window application to a variety of foreign languages. With the Traditional Chinese version of Windows 2000, all of my forms and controls are vertically stretched. Some of the controls run off the bottom of the form too. The spacing between the controls is taller than usual. I cannot reproduce this strange behavior with any other versions of Windows, including French, German, and English. I cannot reproduce this bug with applications written with VB 6.
I have tried downloading other sample .Net Window applications from the web and they also suffer from the same problem. Are there any ways to get around this problem? I have not actually translated any of the string contents to any other languages yet.
Wesley Leong
|
|
|
|
|
Anyone recommend a good component to sync a sql database to Outlook's contacts/tasks/events? Intellisync looks great, but $50K(!) is a bit steep.
Thanks!
Chris
|
|
|
|
|
How about a link to the article your talkin' about?
I have to ask... What experience do you have in programming? Be it COBOL, Fortran, C++, C#, any version of BASIC, WinSock, SDK's, .NET Framework, ... ?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
Now I read images properties with "type declaration".
But I don't still image's read pixels.
How I read image's line? (10W, 50H)
1,2,3,4,5,6,7,8,9,10W, 1st H
1,2,3,4,5,6,7,8,9,10W, 2st H
1,2,3,4,5,6,7,8,9,10W, 3st H
...
1,2,3,4,5,6,7,8,9,10W, 50th H
http://www.2ncielbilgisayar.com
|
|
|
|
|
HI,
I can't fully understand your question but if your trying to read the image pixel in VB then here's an alternative.
1. Put a PictureBox in your form.
2. Load your desired image by setting its Picture property.
3. Then use this code
dim x as long
dim y as long
dim rgbColor as long
For y = 0 To picBox.ScaleHeight - 1
For x = 0 To picBox.ScaleWidth - 1
rgbColor = GetPixel(picBox.hDC, x, y)
Next x
Next y
|
|
|
|
|
You understood me. Thank you.
rgbColor = GetPixel(picBox.hDC, x, y)
I saw a few .hDC in example codes.
And you wrote .hDC in your code.
what does .hDC?
Has vb6 got GetPixel command?
http://www.2ncielbilgisayar.com
|
|
|
|
|
GetPixel is an API. You can declare this at the top of your code
Private Declare Function GetPixel Lib "gdi32" _
(ByVal hDC As Long, _
ByVal x As Long, _
ByVal y As Long) As Long
hDC is a device context handle, needed when working a display or printer. This can be compared to HWND when your are working with window object, one use of HDC on the other hand is for drawing.
|
|
|
|
|
I am working on a VB.Net application that will have forms with textboxes and datagrids and will populate with data from a database. When the user makes a change to a value or many values. How do I update my database,I do not mean how to write an Update statement. There are several tables involved and I am looking for the best way to update when the user hits the save button. Do I have to update all the tables or is there a better way to track modified fields.
Also, any suggestions on using Datadapter to fill dataset amd update modified rows datagrids.
Thanks
|
|
|
|
|
Hi,
I've searched hi and low to find out how you can draw outside of the Form, but haven't found anything!
Please can anyone help?
I'm trying to draw rectangles outside of my Form, of course it gets Clipped by the Form itself. I've tried to modify the Clip for the Form, but I can't seem to change it whatsoever. Is it possible to create a Graphics object for Windows itself? So that you can draw anywhere on the screen??
Any help or advice would be much appreciated!!
Many thanks!
Richard
|
|
|
|
|
I am looking for scripts or classes that can do the following:
1. Search through a set of folders for html files
2. Open the files one by one to parse
3. Count tags and attributes in each html document, tally how many of each in the document, and output the tallies to a file
4. Give properties of the html file, like file size
I've done asp.net development before, I just have never had to do any of these things. If you can help with any of these 4 things, I would greatly appreciate it. VB preferrably, but I could use C#.
Thanks so much.
I would rather do a VB Project than ASP.NET, but could use that code, too!
|
|
|
|
|
hello to all
i got some problem with child forms in my vb.net application.
in my application i need to maximize some child forms when they are loaded (set the windowstate to maximized at design time).
if i do so then, the next form opened which is not be maximized and the windowstate is also set to "normal" at design time also getting maximized (awwwwww it sucks). why this happens so ?. (i guess its setting the prev. forms window state .... )
i have set the maximizebox to "flase" for all the forms which i don't want to maximize and set the formboaderstyle to "fixedsingle"
to solve my problem what should i do ?
in short >> i want to retain the childforms windowstate property set at design time (not to be changed automatically at run time)
please some body help me out ...
adv. thanks
Mohan G
|
|
|
|
|
This is how Windows is designed. You can't change it and there is no way around this.
If you maximize a client window, they all get maximized. If you restore a client window to normal, they all are returned to normal.
If you want to simulate a miximized form, you'll have to size it to the client window area in code and update the size if the parent window's size changes.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
thank you rage
as you said its behaving the same
so i have changed my other forms to normal only (which were needed to load as maximized earlier) hope the problem will be solved ...
|
|
|
|
|
Hello,
i like to seperate an incoming string to an array. The values are delimited by commas.
input string format like "122.23, 232.0, 12.34"
I think of using the split function:
<br />
Dim inputstr as variant<br />
<br />
list = split(inputstr,",")<br />
<br />
After this i like to put the several values in double format variables. This require some typecasting, right? Does anybody has the syntax for the loop and the typecyasting? I am new to vb..
happy coding,
-mark
|
|
|
|
|
Hi Mark, not sure which version of VB you're using (VBA, VBCLassic, or VB.Net)
for splitting the string in VB.Net...
Dim input as Object = "122.23, 232.0, 12.34"
Dim arrList() as String = CStr(inputString).Split(","c)
for casting the remaining items from the stringarray to a double format recursively in VB.Net...
Dim arrCosts(arrList.GetUpperBound(0)) as Double
for i as Int32 = 0 to arrList.Length - 1
arrCosts(i) = Double.Parse(arrList(i).Trim)
next
arrCosts is an array of your Numbers in Double format.
hope this helps.
-jim
|
|
|
|
|
Thanks, i am using vba on excel 2003
happy coding,
-mark
|
|
|
|
|
mmh, by the way do you have an VBA implementation?
happy coding,
-mark
os win2000 vba office 2003, vc++ 6.0
|
|
|
|
|
sorry mark, i have absolutely 0 experience with vba and i don't want to give you bad information. this small bit shouldn't be that difficult to translate though.
actually, thinking about it, in vba are there any other data types other than variant? or am i thinking of vb script...
-jim
|
|
|
|
|
dim str as string
For Each str in list
Value = CDbl(str)
Next
This should probably work
"if you vote me down, I shall become more powerful than you can possibly imagine" - Michael P. Butler.
|
|
|
|
|
Hi,
confusing.. So how must be the code to read out the input string into the the double type text fields as shown below?
<br />
Dim input As Variant<br />
Dim value(1 to 3) AS double<br />
<br />
input = "122.23, 232.0, 12.04"<br />
.<br />
.<br />
.<br />
<br />
<br />
labelx.caption = value(1)
labely.caption = value(2)
labelz.caption = value(3)
happy coding,
-mark
os win2000 vba office 2003, vc++ 6.0
|
|
|
|
|
Dim i as integer
dim str as string = Split(input,",")
For i = 1 to 3
value(i) = CDbl(str(i-1))
Next
"if you vote me down, I shall become more powerful than you can possibly imagine" - Michael P. Butler.
|
|
|
|
|
<br />
input = "122.23, 232.0, 12.04"<br />
<br />
<br />
Dim i As Integer<br />
Dim str() As String<br />
str = Split(input, ",")<br />
<br />
For i = 1 To 3<br />
value(i) = CDbl(str(i - 1))<br />
Next<br />
<br />
<br />
Labelx.Caption = value(1)
Labely.Caption = value(2)
Labelz.Caption = value(3)
Yeah, this works. But why are the output values no float variables?
happy coding,
-mark
os win2000 vba office 2003, vc++ 6.0
|
|
|
|
|
Hi All,
I need help here. I'm trying to drag a file to my application from windows explorer, then get the file pointer, then I simulate it as if I drag the file to another application, let's say Moto Application. I expect the result to be as the same as I drag the file to Moto Application.
However, the Moto Application somehow doesn't get the file pointer right. Please somebody help me...
Here's my code
<br />
Public Class Form1<br />
Inherits System.Windows.Forms.Form<br />
Implements IMessageFilter<br />
<br />
Public Declare Function DragQueryFile Lib "shell32.dll" Alias "DragQueryFileA" (ByVal HDROP As IntPtr, ByVal UINT As Integer, ByVal lpStr As String, ByVal ch As Integer) As IntPtr<br />
Public Declare Sub DragAcceptFiles Lib "shell32.dll" Alias "DragAcceptFiles" (ByVal hwnd As IntPtr, ByVal fAccept As Integer)<br />
Private Declare Sub DragFinish Lib "Shell32.dll" (ByVal hdrop As IntPtr)<br />
Public Declare Function SendMessageAsInt Lib "user32" Alias "SendMessageA" (ByVal hwnd As IntPtr, ByVal wMsg As Integer, ByVal wParam As IntPtr, ByVal lParam As Integer) As Long<br />
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr<br />
Public Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As IntPtr, ByVal hWnd2 As IntPtr, ByVal lpsz1 As String, ByVal lpsz2 As String) As IntPtr<br />
Public Declare Function GetWindow Lib "user32" Alias "GetWindow" (ByVal hwnd As IntPtr, ByVal wCmd As Long) As IntPtr<br />
<br />
Public Const WM_DROPFILES = &H233<br />
Public Const GW_CHILD = 5<br />
<br />
Public Function PreFilterMessage(ByRef m As System.Windows.Forms.Message) As Boolean Implements IMessageFilter.PreFilterMessage<br />
<br />
If m.Msg = WM_DROPFILES Then<br />
HandleDroppedFiles(m.WParam)<br />
Return True<br />
End If<br />
Return False<br />
End Function<br />
<br />
Public Sub HandleDroppedFiles(ByVal filepoint As IntPtr)<br />
Dim hndl As IntPtr<br />
Dim childhndl As IntPtr<br />
Dim sendstat As Integer<br />
hndl = FindWindow(vbNullString, "Motorola Sync v1.7")<br />
If hndl.ToInt32 <> 0 Then<br />
childhndl = GetWindow(hndl, GW_CHILD)<br />
childhndl = FindWindowEx(hndl, childhndl, "SysListView32", "List1")<br />
<br />
SendMessageAsInt(childhndl, WM_DROPFILES, filepoint, 0)<br />
End If<br />
End Sub<br />
|
|
|
|
|