|
Dave Kreskowiak wrote: You've posted WAY too much.
Yep, that is why I read it only a quarter of a way through, and then went to different forum
Some people have a memory and an attention span, you should try them out one day. - Jeremy Falcon
|
|
|
|
|
Thanks Dave for pointing it out. And yes I'm really sorry about posting too much. It wont happen again.
|
|
|
|
|
I have an object
Public Class Plateobj<br />
Public Order As String<br />
Public Row As String<br />
Public Column As String<br />
End Class
I want to create an array of the Plateobj's
Dim plateinfo() As Plateobj
And then refrence them as follow
plateinfo(0).Order = "One"
But I get the following error "Object refrence not set to an instance of an object"
I guess I am doing something daft, any clues welcome
Ta Very Much
|
|
|
|
|
you still have to initialize the object as follows
<br />
Public Class Plateobj<br />
Public Order As String<br />
Public Row As String<br />
Public Column As String<br />
End Class<br />
<br />
Dim plateinfo() As Plateobj<br />
<br />
'*****<br />
plateinfo(0) = new plateobj()<br />
'*****<br />
<br />
plateinfo(0).Order = "One"<br />
<br />
<br />
|
|
|
|
|
Kevin,
Thanks tried that and still get the same error (on the initalise).
Geoff
|
|
|
|
|
try this
<br />
'declare the array<br />
dim plateInfo() as Plateobj<br />
<br />
'set its bounds<br />
redim plateInfo(10)<br />
<br />
'initialze the array item<br />
plateinfo(0) = new Plateobj()<br />
<br />
'now work with it<br />
plateInfo(0).order = "One"<br />
<br />
|
|
|
|
|
Are the objects in the area always going to be Plateobj? If so you should consider using Generics. Kinds Pseudo Code...
in C#,
List<plateobj> LobjList = new List<plateobj>();
LobjList.Add(new Plateobj());
LobjList[0].order = "One;
|
|
|
|
|
Um I suspect I will end up with other object as I am reading data from oracle and flat data file and writing updates back.
I will give it a go though, knowledege is power as they say.
Thanks
Geoff
|
|
|
|
|
AaaaHa
It works thanks, maybe the day was not wasted
Cheers
Geoff
|
|
|
|
|
|
Ok, out of fear of getting flamed for a question that I should probably know the answer too, I'm going to post it anyways ...
I read articles from time to time, like this one:
http://www.codeproject.com/aspnet/CC_MultiMediaControl.asp
What are (I believe them to be attributes) before the declaration of the property, and what are they used for ... we never covered this in school, at least not yet.
IE:
<Category("Media Player")> _
<Browsable(True)> _
<Description("Show or hide the tracker.")>_
Public Property ShowTracker() As Boolean
Get
Return mShowTracker
End Get
Set(ByVal value As Boolean)
mShowTracker = value
End Set
End Property
Cheers,
Xaverian
|
|
|
|
|
These attributes are for design time support on your user control - they control the way the property shows in Visual Studio's (or SharpDevelop's) property grid when you put the control on a form using the forms designer.
Category: the category the property appears in (if sort by categories is active)
Browsable: Whether the property is visible in the property grid.
Description: The description shown below the property grid.
|
|
|
|
|
Thank you! I thought thats what they were, but wasn't sure, no one has ever explained it to me before. I can see where these can be usefull.
Is there somewhere else that I can learn more about additional attributes that are available? I've seen other attributes used as well, especially the "<serializable>" attribute.
Thanks again!
|
|
|
|
|
|
Thank you ...
I can see why the old cliche' of "10 years to pro" so relates to programming ... there is so much to know!
Thank you agian!
|
|
|
|
|
Hi,
I have an MHT file with few images have been stored inside.
MHT file has been created by IE and I think it is correct.
Header of every image looks like this:
The body looks like this:
------=_NextPart_000_0018_01C651FB.1F763700
Content-Type: image/gif
Content-Transfer-Encoding: base64
Content-Location: file:///C:/Documents%20and%20Settings/GGG/Desktop/RRR%20SKINS/MaT/1-lo.gif
R0lGODlhNAAUAMQAAAAAAP///3TAQ93d3czMzLu7u6qqqpmZmYiIiHd3d2ZmZlVVVURERDMzMyIi
IhEREf///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEA
ABAALAAAAAA0ABQAAAWpYCCOZGmeaKqubOu+cCzPdG2fwq2TuXkwtEIDAGAMToMF7vSbDR4JEcNx
KlBNvVJzNBgCEIEuYEhCKEcOA0IRBgSIwFKWtBUpgAXAQKFEuEcKYCMMB2ttAVZLPnFSByIOBYSH
I2YkaYYDbolYTIwBd4gABHwBfiRPglOlQKabckxERAdiX2FDZCQEXkZhDkVumZ4icy+kCA87NgS+
D47Jz9DR0tPU1dYwIQA7
I use the function URLDownloadToFile for extracting of images and saving on the disk:
file_path=mhtml :/nnn/Copy of Skin\example.mht
full_name=file://C:\Documents and Settings\GGG\Desktop\RRR SKINS\Mat\1-lo.gif
res = URLDownloadToFile(0, file_path & "!" & full_name, absTargetPath & "\" & FileName, 0, 0)
It worked with IE6 ok. I receive error res=-2147467259 (the file was not found) in IE7 and file cann't be extracted.
Could somebody help me please to solve this problem?
Thanks
|
|
|
|
|
having a text box which designate a 'ip address'
how can i check if the user has entered a valid ip address,
and not a string or ...
is there a format in the 'MaskedTextBox' for that ?
and what is the datatype of the field should be in the databsae?
regards
Regards
Ramy
|
|
|
|
|
1) valid format -- check it "manually" though code -- i don't know if the maskedtextbox or regular expressions can put a limit on the number(<=255)within each segment.
2) valid ip -- if your using 2005 - you can ping it
3) datatype -- string
|
|
|
|
|
valid format -- check it "manually" though code
and how is that??? :S
Regards
Ramy
|
|
|
|
|
Dim sIP As String = "192.168.0.1"
Dim sa() As String = sIP.Split(".")
If sa.Length <> 4 Then
MsgBox("invalid ip")
Exit Sub
End If
For i As Int16 = 0 To sa.GetUpperBound(0)
If Not IsNumeric(sa(i)) OrElse CInt(sa(i)) > 255 OrElse CInt(sa(i)) < 0 Then
MsgBox("invalid ip")
Exit Sub
End If
Next
|
|
|
|
|
|
I am a novice so I may not be a 100% correct but try this
If Not(Textbox1.text like "###.###.###.###")then
msgbox("You have not entered a valid format.")
Else
'perform routine.
End If
This should at least ensure they are entering the proper format (not a string, or odd characters, but it will not validate the IP address.
|
|
|
|
|
Hi,
i am using fileget to read a file, but i am going the following error:
System.Security.SecurityException was unhandled
Message="Late bound calls to file system methods in the Visual Basic runtime are not permitted."
My code is the following:
Public Structure rec
<vbfixedstring(4)> Public icount As String
<vbfixedstring(48)> Public iTellerID As String
<vbfixedstring(48)> Public iTellerName
End Structure
Public myrec = New rec
Dim iFr As Short
iFr = FreeFile()
FileOpen(iFr, "day_08.log", OpenMode.Binary, OpenAccess.Read)
FileGet(iFr, myrec,1)
FileClose(iFr)
What i am doing wrong? Please help.
|
|
|
|
|
You can find examples of reading and writing binary files in VB.NET here[^].
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Thank you for replying,
The matter is that i am trying to read a data file. The company who wrote the file sent me a sample of how to read their file but the problem is that the sample is in c++ and my app is in vb.net
the data file sounds like that:
?
‰ L $100 CB 36772579 C $100 FB 49553858 B $100 FL 01935605 A $100 FB 63796061 A $100 FB 33316613 A $100 AB 665
The sample code is:
typedef struct tag_RawDataNoImage
{
// Default Data
char iTellerID[48];
char iTellerName[48];
char iWorkstationID[16];
char iCustomerName[48];
char iCustomerACNo[32];
char iCustomerAddr1[64];
char iCustomerAddr2[64];
char iCustomerIDNo[32];
// Counter Data
SYSTEMTIME iDateTime;
int iType; // 0:Dollar , 1:Euro
int iDenom[10];
int iUnit[10]; // Number of each denomination
int iTotalUnit; // Total Number of count
int iTotalAmount; // Amount of count
int iUVMG; // 0-None , 1-UV , 2-MG , 3-UV/MG
char iImgResult[MAX_ROW_COUNT][32];
} RawData;
int main(int argc, char* argv[])
{
unsigned int i;
CFile file;
DWORD iRawDataCount;
RawData data;
CString itemStr, dataStr;
int uIndex,fOfs;
if(argc < 2)
{
printf("please enter name of Raw file. ex: Day_08.log\n");
return 0;
}
if(!file.Open(argv[1], CFile::modeReadWrite ))
{
printf("File open error!!!\n");
return 0;
}
file.Read(&iRawDataCount, sizeof(DWORD));
file.Seek(sizeof(DWORD),CFile::begin);
for(i=0;i
|
|
|
|